Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

By "variable" I mean a name with a value attached. It doesn't necessarily have to mutate. Forth doesn't let you define these within procedures. Values are communicated implicitly on the stack in Forth, where other languages give them names and then use the names to say where the value goes. From a compiler perspective, you could think of this as the difference between JVM bytecode and LLVM IR.


> By "variable" I mean a name with a value attached.

I'd just use "symbol" then. Symbols don't have much utility without a referent.

> Forth doesn't let you define these within procedures.

"within" vs "not within" seems like a distraction. Forth certainly allows defining your own symbols.

> Values are communicated implicitly on the stack in Forth, where other languages give them names and then use the names to say where the value goes.

Forth uses names, too. Other languages have unnamed expressions too. I just don't see the distinction you're drawing as meaningful.


> "within" vs "not within" seems like a distraction.

It is a quite significant difference. A name bound at global scope exists with only one value. A name bound at function scope can be instantiated with different values depending on what the function is called with, and can hold multiple values at the same time if the function makes a recursive call to itself.

> I just don't see the distinction you're drawing as meaningful.

Yes, most languages are Turing-complete, so there isn't technically a difference between them. You are welcome to think the difference between Forth and other languages is not meaningful.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: