5 ms·
I've never heard of a concatinative programming language before this. I can of course google, but since you obviously find these languages very interesting, I'l
by thenoblesunfish 5y ago
I've never heard of a concatinative programming language before this. I can of course google, but since you obviously find these languages very interesting, I'll ask: what's a first, interesting thing I should know about them?
- brakmic 5y agoAnother concatenative programming language: https://factorcode.org/ https://factorcode.org/
- funbdgdhctj 5y ago... that it is spelled "concatenative". The website makes the same mistake as the title here.
- lebuffon 5y agoForth is the grand-daddy I believe. Kitten is a new one and pretty cool. (search Youtube for a demo) Concatenative programming is interesting in that the arguments, in and out, are implicit because they typically reside on some form of stack or as objects on a stack. (implementation details) It might sound useless but one benefit is it simplifies factoring code greatly. If you see a common phrase in your code repeated many times, you can just cut it, paste it into a new definition, replace all the instances of the common phrase with the new definition and everything still works as before.
- mikewarot 5y ago>If you see a common phrase in your code repeated many times, you can just cut it, paste it into a new definition, replace all the instances of the common phrase with the new definition and everything still works as before. This is a profound distillation of the essence of Forth. You can stop repeating yourself without the need to work out all the parameters, variables, return values, etc.
- zozbot234 5y agoThe underlying limitation though is that this is only literally true of FORTH code that is literally repeating itself - identical sequences of tokens. As soon as you start pervasively using stack manipulation ops to deal with more structured kinds of data and control than what's involved in very simple programs, this property becomes rather less useful.
- lebuffon 5y agoI take your point that it is not perfect but it is simpler than factoring where named data is required. My experience is that when it doesn't work, it might indicate that the code is fighting with how Forth is easiest to use. I try to use Forth per Chuck Moore's philosophy and use many small definitions. This makes the code more like functional programming such that even data is handled by code snippets. When I get this right, factoring becomes trivial.
- mikewarot 5y agoThe trade off made for not having to deal with getting the parameters named, etc... is that if you're off by 1 anywhere in the number of parameters, everything blows up, which is why Forth is hard to write big systems in.
- lebuffon 5y agoFor sure feeding wrong args to a function is never good. Experienced Forth users seldom have that particular argument count problem but all the other mistakes in programming are on the table. There is no free lunch. The Forth coding process involves using interactive testing of your code as you write it. Every variable, constant, data-structure and sub-routine can be easily verified at the interpreter. And... given what you said it is advisable to do it. :) ANS Forth supports local variables for those times when "stackrobatics" might make you crazy. Although small, the Forth community has made good progress in this alternative way to code. Some of the newer concatenitive languages working with a clean slate have gone farther in improving the programmer interface. Forth remains at its core close to the metal. Is a 1.2 million LOC large enough? https://ribccs.com/solutions/solution-candy https://ribccs.com/solutions/solution-candy Written in MPE VFX Forth, native code compiler for Windows. *I have no connection to MPE UK but have used their cross-compilers in the past.
- yiyus 5y agoIt has several interesting properties. It is quite a rabbit hole, but a nice one to get lost into. I would say that the most interesting thing you should know about them is that practically everything they do is manipulating a stack (actually, there are usually two stacks, I don't know if this is the case for Stabel). What I find more interesting about them is their simplicity (comparable only to Lisp), which makes possible writing a basic interpreter in only a few lines of code. Being more concrete, an important property of concatenative languages is that they allow a point-free programming style, which gets a bit to get used to but really makes you think in a different way. If you already feel curious, I would suggest the book "Starting FORTH" before looking into more modern (and practical) alternatives.
- Skinney 5y agoTo me, a very appealing feature is how everything becomes a pipeline. Other languages needs careful api design for objects/structs/records to be used in a pipeline, but in concatenative languages it is implicit.
- dolmen 5y agoThis wiki about concatenative programming language probably has all the answers: https://concatenative.org/wiki/view/Concatenative%20language https://concatenative.org/wiki/view/Concatenative%20language