6 ms·
I'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
by funny_falcon 4y ago
I'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!
- Warwolt 4y agoEh, isn't it a bit of a stretch to claim you can program functionally in C? You can mimic it, but without easy closures you can't follow _any_ functional programming patterns that are built on composing functions into new ones in expressions (e.g. binding the operation argument to a fold) C is great, and it would be cool to see something that is similarly close to the instruction set but has functions as values
- IncRnd 4y agoA functional programming language is a programming language in which functions are first class citizens. C is such a language. Of course there are many programming patterns that are in more acceptable functional programming languages than C. Whether a programming language is considered functional is not the same as which patterns are supported in the language.
- lptk 4y agoYour idea of what FP means is completely nonstandard. For the record, there is not one accepted definition, but we can get close by saying that FP languages are those based on lambda calculus as their semantics core. And the primary mechanism in lambda calculus is variable capture (as done in closures). C is based on the Von-Neumann model and has absolutely nothing to do with the lambda calculus. No reasonable PL expert considers it functional.
- deleted 4y ago[deleted]
- scns 4y agoThere is a book about it [0], you can download it here [1]. It uses SML to teach FP. I did the exercises on the train in Termux and Vim. [0] https://www.semanticscholar.org/paper/Functional-C-Hartel-Muller/31acb7abaf3a1962b27be9faa2322038d1ac9ed7 https://www.semanticscholar.org/paper/Functional-C-Hartel-Mu... [1] https://ris.utwente.nl/ws/portalfiles/portal/5128727/book.pdf https://ris.utwente.nl/ws/portalfiles/portal/5128727/book.pd... (edit) add download link and background.
- ncmncm 4y ago> My definition of low level is ... This is a very deep and mature assessment. I have high expectations for the future of Ante. Higher than Rust, in particular, provided it supports some analog of destructors.
- tonyg 4y agoThere's a lovely Perlisism for this: "A programming language is low level when its programs require attention to the irrelevant." Which is interesting in this context because it's clearly not a good fit for Ante, where it looks like many traditional features of "low-level" languages no longer require such attention! So maybe it's not Perlis-low-level; maybe it's "machine-oriented"?
- deleted 4y ago[deleted]
- throwaway17_17 4y agoThis was basically my motivation when I designed the language I use for my day-to-day tasks where I program. I just wanted a ‘functional’ sort-of language that compiled to C. Even though I’ll never release it, it was a rewarding theoretical and practical exercise. As an aside, I really love how detailed and example-ful Ante’s site is. It looks like a ‘fun’ language and I hope the creator keeps working on it.
- funny_falcon 4y agoMay be it is time for "coming out"? (Excuse me for the joke). Really, perhaps your language is The Next One.
- throwaway17_17 4y agoI strongly doubt that, most people would look at it and say it was a concatenative language (it’s not, but that is a semantics issue) and immediate disregard. The language, while being a modal dependently typed language, there is no mandatory ‘safety’ features and memory is largely manually managed. And after the blowback, complaints, and negativity posts about Hare on HN, I just don’t care to argue the fact that my language exists.
- ithkuil 4y agoThere is a group of programming language enthusiasts that would be interested in all sorts of languages. Then there are people who will criticize just about anything for the sake of doing it. Just ignore those people and make a day more interesting for the people who share your passions.
- throwaway17_17 4y agoThat is the argument that has been made by my few friends who are interested in PLT as well. The other option I’ve considered if starting a blog or similar (although my son keeps suggesting a YouTube channel) and doing a longer series of posts concerning the language, type theory, and category theory inspirations present in the semantics of the language. I would love to imagine I could be the next Andrew Kelly (creator of Zig), I don’t know that I can actually be a language founder.
- cardanome 4y ago> fun stuff of algebraic effects, lifetime inference, and refinement types > I'd really like to find "the low-level functional language" without "the fun stuff" But current stable Ocaml has neither of the "fun stuff" mentioned and compiles to native code. So isn't that exactly what you want? It doesn't even need lifetime analysis because automatic garbage collection be praised. And algebraic effects are awesome. Sure they are not mainstream yet but conceptional there is a strong parallel to the Common Lisp condition system which is quite established. Not sure why you wouldn't want to have them. Also it is still a long way until we will see them used in user facing stuff in Ocaml.
- funny_falcon 4y agoOcaml doesn't compile to C. Sometimes having translated C source is major gain. I'm not Ocaml implementation expert, but I suppose Ocaml exception handling and garbage collector could be tricky to aware about when one extend or embed Ocaml. To be honestly, my fellow did Ocaml embedding once. He made able to load natively-compiled plugins written in Ocaml into C based software. And it worked. I didn't dig into details, though. There was at least one bug regarding garbage collection (and it happens that I fixed it).
- Drup 4y ago`ocaml-ctypes` currently supports "reverse-bindings" (making OCaml functions available from C) out-of-the-box and mostly takes care of the intersection you are talking about, so this already works quite well. The only gain from emiting C code is portability to weird architecture that would be covered by C compilers but not the OCaml one; which is arguably a pretty niche use-case.
- omniscient_oce 4y agoI thought OCaml was dropping support for 32-bit ARM. I wouldn't call that a weird architecture to want to run on.
- quickthrower2 4y agoWhy compile to C when you can use LLVM?
- jfecher 4y agoC can sometimes be an easier target since you don't have to learn LLVM's API. C is also more portable than llvm since there is a greater variety of C compilers for a greater variety of architectures than llvm targets.
- marssaxman 4y agoC as an API changes far more slowly than LLVM, too. Using LLVM is a real maintenance commitment.
- deleted 4y ago[deleted]
- brokenkebab2 4y agoFor functional lang transpiling to C, you can look at Fennel - a Clojure dialect over C. However, if you want functional and statically typed, then you are probably out of luck.