Live data from Hacker News

Forth: The Hacker’s Language

hackaday.com

81–90 of 111 posts

Re: Forth: The Hacker’s Language

#81
post #53
post #52

Earlier quoted context omitted.

> Any realistic alternative to C must understand interrupts, memory mapped registers etc.. In what way does C understand interrupts?

Borland C used to, and I believe OpenWatcom still does. Haven't seen any other one that did for a long time.

Most C compilers do, but those are language extensions, not defined on the language's standard thus not portable across compilers.

Re: Forth: The Hacker’s Language

#82

Why do you think some of the so-called hacker languages were pretty popular at a time (perl, lisp), and not the others (forth, apl?)

For Forth, that's an easy answer: when you think "hacker" you're thinking of people working on the Big Iron. Forth's niche was small machines, so while it had a good bit of popularity on the micros, its influence on the mainframe hackers, with their "we hate micros" ethos, was minimal.

I suspect younger programmers can't even begin to imagine what it was like. I learned to program on the Commodore 64. The default language was (Microsoft) Basic. Line numbers. Only flow control IF, GOTO, and GOSUB/RETURN. No loops, no ability to write functions, nothing like a define or a macro.

And then I got my hands on a Forth. Functions. Control structures. Maybe they weren't fancy by modern standards, but they were easily an order of magnitude better than Basic's, and you had the ability to write new ones fairly easily. Quick compiles, code which was both small and fast. Easy inline assembly code for when you needed even more speed. It was a dream come true.

Re: Forth: The Hacker’s Language

#83
The main reason I fell in love with the HP 48 calculator series was the RPL programming language, which could be described as the pragmatic lovechild of Forth and Lisp - think Forth with higher-order functions.

Re: Forth: The Hacker’s Language

#84
post #82

Earlier quoted context omitted.

For Forth, that's an easy answer: when you think "hacker" you're thinking of people working on the Big Iron. Forth's niche was small machines, so while it had a good bit of popularity on the micros, its influence on the mainframe hackers, with their "we hate micros" ethos, was minimal.

I suspect younger programmers can't even begin to imagine what it was like. I learned to program on the Commodore 64. The default language was (Microsoft) Basic. Line numbers. Only flow control IF, GOTO, and GOSUB/RETURN. No loops, no ability to write functions, nothing like a define or a macro. And then I got my hands on a Forth. Functions. Control structures. Maybe they weren't fancy by modern standards, but they w…

We younger programmers started with Scratch. Sure, it makes pretty pictures, and you don't have to type, but it has only global and object-local variables, barely has function calls, and is generally awkward.

Or at least, it was last I used it.

Re: Forth: The Hacker’s Language

#85
post #82

Earlier quoted context omitted.

I suspect younger programmers can't even begin to imagine what it was like. I learned to program on the Commodore 64. The default language was (Microsoft) Basic. Line numbers. Only flow control IF, GOTO, and GOSUB/RETURN. No loops, no ability to write functions, nothing like a define or a macro. And then I got my hands on a Forth. Functions. Control structures. Maybe they weren't fancy by modern standards, but they w…

We younger programmers started with Scratch. Sure, it makes pretty pictures, and you don't have to type, but it has only global and object-local variables, barely has function calls, and is generally awkward. Or at least, it was last I used it.

I read through the recent thread on teaching kids to code (https://news.ycombinator.com/item?id=13499626) and was mildly perplexed at how seemingly successful Scratch has been.

It wasn't until the 2nd or 3rd time I'd used it that I actually figured out how to make sense of it and run something (for Scratch's definition of "run").

To be honest I've progressed extremely slowly with CompSci/programming over the past 18 years I've been using them (got my first computer around 7-8) - I started with QBasic, been shouting at PHP for way too long, I have a basic understanding of C I badly need to develop, and I'm moving toward playing with Lua next - and I hardly consider myself a dyed-in-the-algorithms academic type with a brain that's unable to understand Scratch. (In fact, I'd argue that the best programming teachers would be precisely those types of people, and if they were unable to understand Scratch that would be a major problem.)

Rather, I firmly believe Scatch's UI is a disaster, and horribly unintuitive to use. Other languages are beset with grammatical idiosyncrasies; with Scratch you have to learn the UI before you can learn the... few parts of the language that are actually there.

I'm concerned that systems like Scratch are so widely used; I fear that it's an even worse mind-scrambler than the bad sides of BASIC. Of course, like BASIC, there are good sides, and it teaches the basics without presenting a Mt. Everest-sized learning curve. Perhaps https://en.wikipedia.org/wiki/Dartmouth_BASIC was the Scratch of 1964, and I'm just griping about the dilutory effects of educationally-targeted software in this day and age and "modern" GUI design.

Scratch is also really slow/laggy on my old laptop (Thinkpad T43), I can't imagine how bad it is for schools with limited hardware.

Re: Forth: The Hacker’s Language

#86

I quite like Forth. It feels like a blend of lisp and apl. And even ml if you squint a bit at it as an applicative as composition system. People on reddit seems to hint at the fact that Forth people stay under the radar because it allow them to design and solve problems in better ways. I wonder how true it is ..

The more likely culprit is this: > But Forth is also like a high-wire act; if C gives you enough rope to hang yourself, Forth is a flamethrower crawling with cobras. There is no type checking, no scope, and no separation of data and code. You can do horrible things like redefine 2 as a function that will return seven, and forever after your math won’t work. (But why would you?) You can easily jump off into bad sectio…

> Think of why Go works so well for Google: it's designed for code bases that are maintained by many people.

There's another dimension of this that works for Google, though, and it's one that people particularly here should take note of.

As far as I can tell, Go is a language where the solution to a given expressive problem is usually "write more code." There's nothing subtle or clever to leverage into a multiplier, like there is with Forth or LISP. You don't write a DSL. You don't factor out largely common implementation details. You may well not create composable subcomponents for some intermediate level. Instead, you put in the time, turn the crank, and create whatever straightforward code solves your concrete problem at the level it's written, straightforward if verbose. It's similar to how MJD describes working in Java (http://blog.plover.com/prog/Java.html ), except you're missing some of Java's expressive power and you have some of Pascal's to make up for it.

There's a degree of simplicity to it.

An organization like Google is not lacking in any way resources to have developers produce more code. Or understand it, if any issues with expressivity to volume ratio ever makes a given codebase difficult to grok.

Does your organization have those resources?

Do you?

The answer to that question (along with who you're competing with) might tell you whether you should be using a Google language or a hacker language.

Re: Forth: The Hacker’s Language

#87
post #51

There is a decent amount of Forth publications out there, but nothing that really takes you from A->Z in building your own Forth based off of Assembly or C. JonesForth helped me conceptually understand parts of Forth, but there is a lot missing there for me to be able to start from scratch. I would pay $ for a real book in the vein of "Land of Lisp" that shows you how to build a Forth compiler/editor and how to exten…

You might find R. G. Loeliger's book "Threaded Interpretive Languages: Their Design and Implementation" [1] interesting. Here's a review [2]. The comments on that review list some online resources that might also be useful. It's long out of print, but used copies are cheap, and scans are readily findable on the net. I wrote a comment a while back outlining how to do a FORTH-like language from scratch by starting with…

Thank you!

Re: Forth: The Hacker’s Language

#88

Earlier quoted context omitted.

I've wanted to use Forth IRL for ages, but have no good use case for the problems I solve

If you want to build an SBC, than Forth is the language to write that code in.

SBC meaning ? single board computer ?

Re: Forth: The Hacker’s Language

#89
post #81
post #53

Earlier quoted context omitted.

Borland C used to, and I believe OpenWatcom still does. Haven't seen any other one that did for a long time.

Most C compilers do, but those are language extensions, not defined on the language's standard thus not portable across compilers.

Yep. If nothing else, just about all of them have the asm keyword. That's non-standard (but almost always present) in C compilers, and "conditional" in C++ (i.e. the keyword is in the standard, but the semantics are implementation-defined).

And yeah, it's a given that it's going to be non-portable.

Given asm, implementing a Turbo C-style int86() function seems pretty trivial. It might even be doable as a macro.

Re: Forth: The Hacker’s Language

#90
post #85

Earlier quoted context omitted.

We younger programmers started with Scratch. Sure, it makes pretty pictures, and you don't have to type, but it has only global and object-local variables, barely has function calls, and is generally awkward. Or at least, it was last I used it.

I read through the recent thread on teaching kids to code ( https://news.ycombinator.com/item?id=13499626 ) and was mildly perplexed at how seemingly successful Scratch has been. It wasn't until the 2nd or 3rd time I'd used it that I actually figured out how to make sense of it and run something (for Scratch's definition of "run"). To be honest I've progressed extremely slowly with CompSci/programming over the past 1…

When I used Scratch 1.4, I don't recall the UI being too bad, and it ran pretty fast: Smalltalk is pretty good at that. But I'm generally pretty good at picking up these sorts of things, and my computer wasn't particularly slow.

If you want a Real Language presented the same way, Snap! (descended from BYOB) is essentially a Scheme in Scratch's clothing.

But the two real draws of Scratch were its hackability and its community. Back before Scratch 2.0 ruined everything, Scratch was written in Smalltalk, and using a widely-known hidden feature, you could examine the source code and make whatever changes you wanted with relative ease, resulting in a healthy community of mods and derivatives which explored new features and ideas, or those that the official team had dropped by the wayside (like Mesh, a fully-featured networking system).

Scratch's community was likewise excellent: I spent a lot of time lurking in the Scratch Advanced Topics forum - a sort of off-topic general programming section, where people far smarter than I discussed modifying Scratch, improving the website, and whatever programming projects they happened to be working on (usually web programming in PHP - it was the mid 2000s, after all).

But that's enough nostalgia for one day...

Post reply on HN