News for hackers. Stuff that matters.
Re:Retro: A modern, pragmatic Forth by retrocryptid on Tuesday July 11, 2023 @02:56PM (#36685659)
Cool beans. The literate coding system they're using (Unu) is a bit primitive, but it's GREAT that they're using one at all.
Re:Retro: A modern, pragmatic Forth by zimpenfish on Tuesday July 11, 2023 @03:10PM (#36685867)
> The literate coding system they're using

We need a new name for this kind of thing[1] because it's not really literate programming - you can't re-order your code blocks in the literate source files and have them come out in the right place in the code source files which is, I think, a key part of it being literate programming. Don't get me wrong - I use this a lot with the various *occos - but it needs a name of its own.

[1] Assuming we don't already have one that I've missed.

Re:Retro: A modern, pragmatic Forth by dllthomas on Tuesday July 11, 2023 @03:17PM (#36685946)
Sadly, I think the new name for this kind of thing has been "literate programming" for the past 20 years at least, while the literate programming that Knuth described has been renamed something like "the literate programming that Knuth described".
Re:Retro: A modern, pragmatic Forth by mananaysiempre on Tuesday July 11, 2023 @03:47PM (#36686342)
I think Docco was when that approach acquired some kind of popularity? So 2010 or so[1].

Of course Haskell has had its “literate format” since forever (ETA: the Haskell 1.2 report[2], dated March 1992, has a description in an appendix), and it became mildly popular for Haskell blogging when blogs caught on, but its name was always accompanied by a side note that in Haskell you don’t really need to reorder things (kind of true).

[1] https://github.com/jashkenas/docco/commit/9b666b77c476fd76b9...

[2] http://haskell.org/definition/haskell-report-1.2.ps.gz

Re:Retro: A modern, pragmatic Forth by dllthomas on Tuesday July 11, 2023 @03:56PM (#36686460)
I recall, on first encountering Literate Haskell at some point after 2010, mentally comparing it to something I thought I recalled from earlier in the perl ecosystem (on top of being vaguely aware of Knuth's stuff, although I hadn't actually read up on it at that point - at this point I have a copy on my desk).
Re:Retro: A modern, pragmatic Forth by mananaysiempre on Tuesday July 11, 2023 @04:07PM (#36686559)
POD? I’ve only encountered people using it to embed manpages into their single-file scripts, even if it turns out that the documentation[1] doesn’t consider this the canonical use case and demonstrates something much more like LH. But then I’ve never done much Perl.

[1] https://perldoc.perl.org/perlsyn#PODs:-Embedded-Documentatio...

Re:Retro: A modern, pragmatic Forth by dllthomas on Tuesday July 11, 2023 @04:24PM (#36686741)
I don't think it would have been POD (which I agree isn't the same thing) but maybe. It's been a while.
Re:Retro: A modern, pragmatic Forth by WorldMaker on Tuesday July 11, 2023 @03:24PM (#36686027)
It's in the interesting overlap space with Notebooks. I don't know if that is a name you'd want to reuse for "non-reorderable literate programming", especially as more Notebooks move the other direction and support cell reordering.
Re:Retro: A modern, pragmatic Forth by crc_ on Tuesday July 11, 2023 @04:15PM (#36686641)
I'd love to have a better name for this, and am quite willing to change my description of it when I find one.
Re:Retro: A modern, pragmatic Forth by d4rti on Wednesday July 12, 2023 @03:39AM (#36691484)
Semi-literate programming?
Re:Retro: A modern, pragmatic Forth by wolfgang42 on Wednesday July 12, 2023 @12:39AM (#36690528)
My take on this is that TANGLE-style reordering is much less necessary now that we have ubiquitous forward referencing. If you read Knuth’s Pearls example[1], a lot of the code blocks would be separate constants or functions; but he’s using WEB to inline them to compensate for the one-pass compiler and associated limitations. In a modern language you already have the freedom to order your code blocks however you want, and you don’t need a separate tool to make this possible. At that point the main advantage that the technique offers is particularly extensive and well-formatted commenting.

McIlroy also touches on this in his review, though from the other direction:

> Perhaps the greatest strength of WEB is that it allows almost any sensible order of presentation. Even if you did not intend to include any documentation, and even if you had an ordinary cross-referencer at your disposal, it would make sense to program in WEB simply to circumvent the unnatural order forced by the syntax of Pascal.

[1] Of “Knuth v McIlroy” fame: https://homepages.cwi.nl/~storm/teaching/reader/BentleyEtAl8...

Re:Retro: A modern, pragmatic Forth by remexre on Wednesday July 12, 2023 @11:36AM (#36696140)
Forth dialects typically don't have forward referencing _or_ variables that can be defined in the middle of a function, though!

(Though, writing a function long enough that you might want to declare a variable part-way through it would probably be a code smell in Forth...)

Re:Retro: A modern, pragmatic Forth by wolfgang42 on Thursday July 13, 2023 @02:41AM (#36705737)
I was vaguely under the impression that Forth only dereferenced words from the dictionary into functions when you call them, but I admit I haven’t actually used it. In that case, being able to reorder your code so you can give the overview of what you’re trying to do before diving into the finer details of its internals does seem like a great help!
Re:Retro: A modern, pragmatic Forth by mananaysiempre on Tuesday July 11, 2023 @04:02PM (#36686517)
> The literate coding system they're using (Unu) is a bit primitive, but it's GREAT that they're using one at all.

There’s an old tradition of annotating Forth code with documentation: code would go into even-numbered 64x16-character “blocks”, accompanying documentation into odd-numbered “shadow blocks”, and on e.g. a VGA you could even view them side by side.