12 ms·
Hello, author here! As the website says, the compiler itself is still in a very early state where basic things like functions, types, traits, inference, monomor
by jfecher 4y ago
Hello, author here! As the website says, the compiler itself is still in a very early state where basic things like functions, types, traits, inference, monomorphisation, and codegen are implemented. The fun stuff of algebraic effects, lifetime inference, and refinement types are not however. Though I can elaborate on implementation strategies of these for anyone curious. For example, algebraic effects in existing languages can be quite slow at runtime due to the use of continuations, the translation to a monad stack, and/or dynamically finding handlers at runtime. It is my plan to monomorphise them away and inline all these cases as in the following paper (1). With this, handlers are inlined into functions, continuations are normal closures, and continuations that aren't called multiple times are inlined.
(1) Zero-cost Effect Handlers by Staging:
http://ps.informatik.uni-tuebingen.de/publications/schuster19zero.pdf http://ps.informatik.uni-tuebingen.de/publications/schuster1...
- charleskinbote 4y agoThanks for sharing! The dot product example gave me pause because map2 seems to be the same as zipWith. Does that exist in Ante? Without context I might have thought map2 was going to act as bimap. Take that for what you think it's worth :) Also I might be having a brain fart -- but isn't the dot product in your example equal to 32?
- jfecher 4y agomap2 is indeed another name for zipWith. I believe I got that name from Racket if memory serves. Compared to zipWith I like its symmetry with the 1 argument map. I also wasn't aware of bimap! I can't seem to find a function of that name online, though I did find the BiMap haskell package, is that what you're referring to? And yes, the dot product should be 32, thank you :)
- pwm 4y agoNot OP but they meant https://hackage.haskell.org/package/base-4.16.1.0/docs/Data-Bifunctor.html#v:bimap https://hackage.haskell.org/package/base-4.16.1.0/docs/Data-... As you have the normal map function for Functors (using Haskell): > :t fmap fmap :: Functor f => (a -> b) -> f a -> f b you can have bimap for Bifunctors: > :t bimap bimap :: Bifunctor p => (a -> b) -> (c -> d) -> p a c -> p b d which specialised to pairs is: > :t bimap @(,) bimap @(,) :: (a -> b) -> (c -> d) -> (a, c) -> (b, d)
- eruditely 4y agoI was wondering why the dot product wasn't 32! Good thing I checked. Also this seems like a cool new language, I need to learn a functional language, I wonder how far this language will go in development.
- benniomars 4y agoI calculated the dot product in my head because it looked off. Then I calculated it in my computer. Then I came to the comment section before losing all confidence in what I thought was a dot product of two vectors.
- avgcorrection 4y agoAs it turns out you and Haskell are wrong with regards to that naming while this language is correct.
- vanderZwan 4y agoAs a person named Job I'm a littly confused by the second example on the website, but that's probably my own interpretation bias :p Joking aside, looks cool, good luck with the project!
- vanderZwan 4y agoAs a person named Job I'm a little confused by the second example on the website, but that's probably my own interpretation bias :p Joking aside, looks cool, good luck with the project!
- b3morales 4y agoLooks like a great start! Your attention to programmer ergonomics is admirable. Added to my weekend hacking reading list.
- funny_falcon 4y agoI'd really like to find "the low-level functional language" without "the fun stuff". Or at least it should have simple and boring subset that is usable without "the fun stuff". Something like Caml Light - precursor to Ocaml - but with translation to C instead of bytecode, so it will be fast and will have comfortable integration with C libraries.
- jfecher 4y agoThis is definitely an interesting thought. My thinking is that "the fun stuff" tends to help make the language more functional, so removing it you are left with a more imperative language resembling a C clone with traits and type inference. Then if you want easier C interop you must remove traits and either remove modules as well or provide a standard method of mangling module names into function names. At that point I think you may as well use an existing "better C" language like Odin, Zig, Jai, C3, etc.
- trumpeta 4y agowhat makes Ante low level? Just from a cursory look over the website seems pretty high level to me.
- jfecher 4y agoMy definition of low level is no tracing GC, values are unboxed by default, and users still have control to do low level things (raw pointers, other unsafe operations) when needed, even if it is not the default.
- IncRnd 4y agoThe generally accepted definition of a low level language is a language that provides little or no abstraction from a computer's instruction set architecture. In actuality, C is a lower level functional programming language than Ante, because C functions are first-class citizens. I like the lack of GC! What is the method for always incremental compilation? The benefits are obvious, but isn't it problematic to have two authoritative representations of the same source? It would be fantastic if you get that to work well!
- rayiner 4y agoVery neat project! I noticed that Ante doesn’t have explicit region type declarations. As I recall, existing algorithms implemented for ML can sometimes infer very large regions which causes memory usage to balloon. It looks like smart pointers are part of the plan to address that possibility, but I’d love to hear more about your thoughts on memory management.
- jfecher 4y agoCorrect, a key goal is to have no explicit region/lifetime annotations. There have been several papers on region inference after the originals by Tofte & Taplin, all attempting to refine the original analysis by inferring shorter lifetimes. First by analyzing when a region can be safely emptied and re-used, then by abandoning the stack discipline, etc. Unfortunately, none of these are viable in a real program in my opinion. Although they each infer shorter lifetimes in a few cases the core problem of "collections will unify the lifetime variables of all elements in the collection" and "branching on a value and conditionally returning it extends its lifetime, even if the branch was not taken" remain unsolved. An ideal solution to me needs to solve these problems. Since there is already a large body of research trying to address this on the static side and failing, I believe it needs to be solved with runtime checks. The specifics of which I'm still exploring but its worth mentioning these would only be necessary to tighten existing lifetimes so one can envision annotations or compiler options to elide these if desired. Lifetime inference in MLKit (and I believe ante as well) tends to speed things up by turning more dynamic allocations into stack allocations, so there is some room there for runtime checks without making the result more expensive than the version with dynamic allocation I believe.
- raphlinus 4y agoHey, thanks for calling my work "not viable!" (Co-author of "Better Static Memory Management" here) Seriously, this looks promising and I'm very interested to see where it goes.
- rayiner 4y agoI’m curious what the rationale is for not making regions explicit in the source code. It seems like a downside of region inference for a systems language is the unpredictability of the inferred regions.
- PowerBallZed 4y agoI don't see a LICENSE file anywhere in the repo or the website. Nobody is allowed to use Ante?
- airstrike 4y ago> Nobody is allowed to use Ante? :eyeroll:
- postingforonce 4y agohttps://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/licensing-a-repository https://docs.github.com/en/repositories/managing-your-reposi... >However, without a license, the default copyright laws apply, meaning that you retain all rights to your source code and no one may reproduce, distribute, or create derivative works from your work.
- airstrike 4y agoWhat do you think is more likely, that the author forgot to add a LICENSE file or that he actually doesn't intend for ANYONE to use the language he created? Give me a break
- kqr 4y agoThe original comment was asking if the current legal status is that nobody is allowed to use ante without acquiring a licence separately (which is true) not whether the author's intention is that nobody use ante (which we don't know, but it seems unlikely.)
- HWR_14 4y agoI thought the original comment was simply a big report: missing license file. With a snarky comment tagged on. I thought everyone assumed that, being shown by the author here, it was the latter.
- ObiWanFrijoles 4y agoThis is a really awesome project and I hope it goes far!