News for hackers. Stuff that matters.
Re:Stabel: A pure, concatenative and statically typed progra... by thenoblesunfish on Wednesday June 16, 2021 @07:23AM (#27527234)
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?
Re:Stabel: A pure, concatenative and statically typed progra... by lebuffon on Wednesday June 16, 2021 @08:57AM (#27527992)
Forth 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.

Re:Stabel: A pure, concatenative and statically typed progra... by mikewarot on Wednesday June 16, 2021 @09:06AM (#27528071)
>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.

Re:Stabel: A pure, concatenative and statically typed progra... by zozbot234 on Wednesday June 16, 2021 @12:14PM (#27530194)
The 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.
Re:Stabel: A pure, concatenative and statically typed progra... by lebuffon on Friday June 18, 2021 @09:01AM (#27549823)
I 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.

Re:Stabel: A pure, concatenative and statically typed progra... by mikewarot on Friday June 18, 2021 @12:44PM (#27552254)
The 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.
Re:Stabel: A pure, concatenative and statically typed progra... by lebuffon on Saturday June 19, 2021 @11:14AM (#27561159)
For 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 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.

Re:Stabel: A pure, concatenative and statically typed progra... by brakmic on Wednesday June 16, 2021 @08:01AM (#27527536)
Another concatenative programming language: https://factorcode.org/
Re:Stabel: A pure, concatenative and statically typed progra... by yiyus on Wednesday June 16, 2021 @10:14AM (#27528717)
It 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.

Re:Stabel: A pure, concatenative and statically typed progra... by funbdgdhctj on Wednesday June 16, 2021 @08:02AM (#27527538)
... that it is spelled "concatenative". The website makes the same mistake as the title here.
Re:Stabel: A pure, concatenative and statically typed progra... by Skinney on Wednesday June 16, 2021 @08:58AM (#27527999)
Thank you! I’ll fix it :)
Re:Stabel: A pure, concatenative and statically typed progra... by azakai on Wednesday June 16, 2021 @09:31AM (#27528323)
Another minor typo, "web assembly" should be WebAssembly (no space, and CamelCase).
Re:Stabel: A pure, concatenative and statically typed progra... by brakmic on Wednesday June 16, 2021 @08:03AM (#27527544)
LOL, Burn! :D
Re:Stabel: A pure, concatenative and statically typed progra... by Skinney on Thursday June 17, 2021 @05:37AM (#27537817)
To 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.
Re:Stabel: A pure, concatenative and statically typed progra... by dolmen on Thursday June 17, 2021 @03:58AM (#27537184)
This wiki about concatenative programming language probably has all the answers: https://concatenative.org/wiki/view/Concatenative%20language