3 ms·
I’m not sure what “feels hackish” means but it sounds suspiciously like a nonspecific complaint that is used when all the actual potential issues have been exha
by ken 6y ago
I’m not sure what “feels hackish” means but it sounds suspiciously like a nonspecific complaint that is used when all the actual potential issues have been exhausted.
In programming, we’re always dealing with stacks. It’s just that they’re usually invisible. As someone dealing with an unexpected user crash in a modern/traditional language, the possibility of making them visible would be pretty helpful right about now! I’d kill for a crash dump that included a data stack, too.
- andrewflnr 6y agoIt's an aesthetic complaint. It has the word "feels" right in it. What do you expect? With that said, as someone who hasn't programmed in Forth-likes but has read about them, I can guess at a more precise complaint: stack manipulation operations like dup, swap, roll, et al are pure noise relative to my business logic. They're implementation details constantly interfering with my intent. And yes, I'm sure if I find just the right factorization into tiny words I could avoid most of the explicit stack twiddling, but is that really a good use of time relative to writing in C? Or figuring out how to design a better language? Doubtful.
- nivertech 6y agoCorrect, there are lots of abstractions under the hood it doesn't mean they need to be intertwined with our business logic. What's next exposing the microcode or physical RAM layout? Even worse majority of ISAs are register-based, not stack-based. So this abstraction is virtual. What I meant is that Forth wasn't designed from first principles. Instead of solving the problem "how to help developer to transform business logic into an application", it solves the problem "how to help developer to program a stack machine". It was fitted to a simple, but useful abstraction - stack machine. Same with Lisp, APL, C, etc. In case of the C language the abstraction was PDP-11 ISA ;) Glorified data structures -> PL: array -> APL list (cons) -> LISP stack -> Forth relation -> Prolog Glorified data structures -> DB: relation -> SQL (RDBMS) map -> NoSQL K/V stores hashpointer -> IPFS hashchain -> Blockchain Merkle Patricia Tree -> EVM
- ken 6y agoHow often do you actually do "dup, swap, roll" in a Forth program, though? The typical Forth program doesn't look like the samples you see on its Wikipedia page, just like the typical C program doesn't look like the samples you see on its Wikipedia page. I could go the other way and say that dereferencing arbitrary pointers, maintaining a \0 at the end of every string, and declaring which variables should live in registers aren't part of my business logic, either. C sure sounds terrible! Just because a language allows low-level implementation details doesn't mean it requires them in every function. I don't understand the logic of having a language which allows you to build your own abstractions, and deciding that it's a better use of one's time to drop it altogether and instead use a language whose only user abstractions are structs and functions.
- andrewflnr 6y agoGranted, C is pretty awful too. My personal favorite option remains "better language". Forth-likes are an under-utilized source of inspiration for sure, but I don't think we should be satisfied with stack-twiddling any more than with C strings.