morning
Morning
g'morrow
Hi guys, for some reason, we are going to do mob programming in Forth next week. Everyone seems excited to do so. Do you have any idea why would Forth be interesting for Clojure dev? I have just tried to hack in it for an hour. It is stateful, nothing is immutable, it seems to be very very low level and the whole concept of reusability is way different from any other functional language. What exactly is that attractive on Forth?
In the past, I have read Color Forth book. Twice. I bought the idea behind until today when I have finally tried to work in Forth. It is exactly the opposite of functional programming. Stack = state is everything. It is even worse than SQL database procedures. They at least have a schema. With Forth, you just have a bunch of data that can be basically anything and you have to somehow believe, you will end up with the right stack in the right time.
And also rearranging of stack seems so hacky to me. For the same reason I don’t like point-free programming in Haskell. Theoretically, you could rearrange anything into a weird mixture of (.) . (.)-ies. The same goes with Forth fith dups, swaps, overs, etc. but without any typing, variable naming, or anything in place.
Forth is a fascinating language but it isn't to everyone's taste.
If you want a modern take on Forth, look at https://factorcode.org/
There's an interesting hybrid of Clojure and Forth-like coding in Gershwin https://github.com/gershwin/gershwin (unfortunately its doc site is no longer accessible). It uses an old fork of Clojure and hasn't been maintained for years but back when we were using that old version of Clojure, I actually converted some of our code at work to Gershwin to see how it worked. It's pretty cool.
The thing is - I thought Forth is fascinating. This is why I read Color Forth book twice. It was all until I have tried to work in it.
Now, it doesn’t seem practical to me at all.
Ah, here's the Gershwin docs https://gershwin.github.io/
Learning radically different languages can make you a better programmer (per Pragmatic Programmer advice) but you need to actually build stuff using it, not just read a book.
I know that learning absolutely different paradigm can make me a better programmer. This is why I learn about Forth, Prolog, APL & J, Datomic, lambda calculus, etc. But catching an “idea behind” from the book is different from using the thing. What if your experience from Macromedia with CF was more useful than my experience with Forth even when CF is more mainstream just because Forth is innovative, but also unnecessarily weird?
Before Clojure, I have tried working in Erlang and I have abandoned the language just because of its weirdness.
I only meant that you can't really internalize the concepts in a language without building something a bit more than a toy with it. And, yea, APL and Prolog would be other languages I'd recommend (I've built stuff in both).
Maybe it’s just me, but I somehow need to lower the cognitive load of the language. I need true to be true. I need a function to look like a function. So I can absorb new ideas in usable way.
Like I said, not to everyone's tastes. I love APL (but dislike J -- using ascii loses the elegance of APL), I love Prolog too -- and I had fun learning Erlang because it reminded me of Prolog so much.
I love APL - in theory. I have never tried to develop anything in it. Even when I have spent a lot of time thinking how to turn all my code into a mixture of comp-s, partial-s and how to treat values the same way as vectors and matrixes. But the thing is - is it really practical once you run into a real world scenario?
And the same goes for Forth. Building bottom up language seems attractive. It is similar promise one gets with Lisp languages. But in fact, I usually end up with 1-2 macros in the whole project.
And in fact, 1-2 macros are just syntactic sugar just because I don’t want to wrap my code in (fn …) for aesthetic reasons and lots of cases for macros are prevented by lazy collections or by reusing existing fns and macros.
I learned APL at an insurance company where it was in very heavy usage.
I originally learned Prolog at university but later worked at an actuarial company that did a lot of work in Prolog.
As for Forth in commercial usage: https://www.forth.com/resources/who-uses-forth/ -- although it's hard to know how many of those companies still use Forth (or even still exist?).
I am sure there are lots of people working in Forth and they would speak happily about it. It is also the reason we do it - one of us was speaking about Forth so much we have decided to do a mob programming coding dojo in it. But as I am preparing for it, it doesn’t seem so good as my expectations.
Perhaps I liked it better because I'd used a reverse-polish programmable calculator at school and I used dc
on Unix a lot...?