r/haskell • u/wengchunkn • Jan 26 '19
How Forth helps learning Haskell !!!
https://groups.google.com/forum/#!topic/comp.lang.forth/lpYwr5JtGbc5
u/qseep Jan 26 '19
I really enjoyed spending some time learning Forth a couple of years ago. It's an interesting way of looking at things, and can lead to some succinct DSLs.
However, I have to say that it's very different from Haskell. For starters, Forth is untyped. Or, more precisely, the types are part of the operations, not the data. This is like assembly language. For example, there is not "32-bit integer" type, just stacks of bytes. But there are different operations for adding 16-bit integers vs 32-bit integers. All the meaning is in the operation. It's the ultimate target for malicious attacks.
Haskell, on the other hand, has a strong static type system, to verify that you can't do the sorts of things you can do in Forth.
6
u/retrac0 Jan 26 '19
The analogy to assembly is pretty apt with Forth. It's possible to implement the entire Forth language in a subset of Forth with as few as half a dozen basic primitives. A number of processors which execute a binary representation of those primitives have been built, effecting making the Forth subset their assembly language.
0
Jan 26 '19
[deleted]
-5
u/wengchunkn Jan 26 '19
Just to share with you my project: Stack Machine Metaprogramming -- a "bigger picture", everything to do with stack machine, implemented in PHP, JavaScript, Python, C/C++ so far ... and more to come.
https://github.com/udexon/SMMP
I will write a longer response as you trigger some important issues .... ;-)
Thank you very much.
9
u/elvecent Jan 26 '19
Broadening one's expertise surely helps further learning, but I fail to observe any similarities between Forth and Haskell. Also, Haskell is not at all that hard to learn.