Live data from Hacker News

Forth: The programming language that writes itself

ratfactor.com

141–150 of 174 posts

Re: Forth: The programming language that writes itself

#141
post #16

If you like Forth, but find it challenging to build real stuff with, Factor ( https://factorcode.org/ ) is most or all of the good stuff about Forth designed in a way that's much easier to do things with. It was designed by Slava Pestov (who I think had a big hand in Swift), and honestly it's a lot of fun to build webapps and other programs with, and much less brutal to read than Forth can be.

I have very fond memories of programming in PostScript within NeWS/HyperNeWS - it did quite a few things that I've never seen in any other environment. Edit: To be fair relying on PostScript probably did limit the appeal, but I actually really liked it.

Thank you fellow HyperLooker! For me, PostScript WAS the appeal!

For the rest of the civilized world, Arthur van Hoff wrote "PdB", an object oriented PostScript => C compiler.

https://news.ycombinator.com/item?id=10088193

>Arthur van Hoff wrote PdB, and we used it for to develop HyperLook (nee HyperNeWS nee GoodNeWS). You could actually subclass PostScript classes in C, and vice-verse!

https://news.ycombinator.com/item?id=29964271

>That's interesting! I love Forth, but I love PostScript even more, because it's so much like Lisp. What is it about PostScript that you dislike, that doesn't bother you about Forth?

>Arthur van Hoff wrote "PdB" for people who prefer object oriented C syntax to PostScript. I wrote some PdB code for HyperLook, although I preferred writing directly in PostScript.

Leigh Klotz used PdB at Xerox PARC, and wrote this about it here:

https://regex.info/blog/2006-09-15/247#comment-18269

>OK, I think I’ve written more PostScript by hand than Jamie, so I assume he thinks I’m not reading this. Back in the old days, I designed a system that used incredible amounts of PostScript. One thing that made it easier for us was a C-like syntax to PS compiler, done by a fellow at the Turning Institute. We licensed it and used it heavily, and I extended it a bit to be able to handle uneven stack-armed IF, and added varieties of inheritance. The project was called PdB and eventually it folded, and the author left and went to First Person Software, where he wrote a very similar language syntax for something called Oak, and it compiled to bytecodes instead of PostScript. Oak got renamed Java.

Syntactic Extensions to PdB to Support TNT Classing Mechanisms:

https://www.donhopkins.com/home/archive/NeWS/PdB.txt

Most of the built-in HyperLook components were written in C with PdB.

I wrote HyperLook wrapper components around TNT 2.0 (The NeWS Toolkit) objects like pie menus, Open Look menus, sliders, scrolling lists, buttons, etc. I used them in the HyperLook edition of SimCity, which you can see in this screen snapshot:

https://www.donhopkins.com/home/catalog/hyperlook/HyperLook-...

Arthur later went on to join Sun (James Gosling's "First Person" group), wrote the Java compiler in Java, and AWT, then left Sun to form Marimba, where they developed "Castanet" (push code and content distribution), and Bongo (HyperCard/HyperLook for Java, with a WYSIWYG UI editor and script editor, that dynamically ran the Java compiler to compile and hot patch scripts attached to objects on the fly. Which was groundbreaking at the time, though IDEs do it all the time now).

https://news.ycombinator.com/item?id=25434613

>Bongo is to Java+HyperCard as HyperLook is to PostScript+HyperCard.

Danny Goodman himself (the HyperCard book author) wrote a book about Bongo! Arthur's Forward explains it well.

https://www.amazon.com/Official-Marimba-Guide-Bongo-Goodman/...

https://archive.org/details/officialmarmba00good

>Foreward

>Marimba was formed in early 1996 by four members of the team that created Java. Kim Polese, Jonathan Payne, Sami Shaio, and I left Sun Microsystems and founded Marimba with the goal to build commercial consumer applications written entirely in Java.

>While at Sun we concentrated on creating a great multi-platform, portable, efficient, object-oriented, multi-threaded, and buzzword-compliant language. However, we paid too little attention to developing tools. In early 1996 Java was largely still a language for skilled programmers who are happy with emacs, a Java compiler, and lots of coffee. Luckily these so-called "Rambo" programmers loved Java and made it very successful.

>Creating large applications in Java turned out to be much harder than we had anticipated, so we decided that we needed better tools before we could build better applications. That is why we created Bongo. Bongo is a tool that allows you to quickly create a user interface using a variety of widgets, images, audio, and animation. After you have created a user interface you can script it in Java, or you can easily hook it up to a Java program.

>Bongo is a high-level tool that provides a clean separation of semantics and design elements.

>It allows multi-disciplinary teams to work simultaneously on a large application without getting in each other's hair. You will find that it is a very powerful tool that is great for creating good-looking, functional, but still very flexible user interfaces. In addition to the standard widgets, Bongo enables you to extend the widget set by creating new widget classes in Java.

>This means that you can develop your own set of widgets which are easily integrated into user interfaces developed with Bongo.

>One of the great features of Bongo is its capability to incorporate applets into user interfaces.

>This enables you to use applet creation tools from third-party software vendors to create components of your user interface and combine these components into a single consistent application using Bongo. This is the way of the future: In future releases, Bongo will naturally support Sun's JavaBeans which will further simplify the process of integrating components created by different tools. This way, you can choose the tools that are appropriate for the job, rather than being stuck with the tools provided by the environment.

>A lot of the ideas behind Bongo are based on a tool called Hyper NeWS which I developed for the NeWS windows system during the late '80s (NeWS was another brain-child of Sun's James Gosling). HyperNeWS used the stack, background, and card model which was popularized by Apple's HyperCard. Bongo goes a lot further than HyperNeWS by allowing arbitrary container hierarchies and scripting.

>I am really excited that Danny has written this excellent book on Bongo. It clearly explains the concepts behind Bongo, and it takes you through many examples step by step. This book is an essential tool for all serious Bongo users.

>Have fun, Arthur van Hoff, Chief Tenology Officer, Marimba, Inc.

Re: Forth: The programming language that writes itself

#142
post #16

If you like Forth, but find it challenging to build real stuff with, Factor ( https://factorcode.org/ ) is most or all of the good stuff about Forth designed in a way that's much easier to do things with. It was designed by Slava Pestov (who I think had a big hand in Swift), and honestly it's a lot of fun to build webapps and other programs with, and much less brutal to read than Forth can be.

Factor is super cool! And the amount of packages ("vocabularies") it comes bundled with is just astonishing.

Re: Forth: The programming language that writes itself

#143
post #32
post #5

Many people glorify the simplicity of Lisp as an interpreter, but Forth is similar and underappreciated. Sadly, the only code I've written in Forth is... PostScript. Yeah, PostScript is a dialect of Forth. As a child, I really was amused by the demo of GraFORTH on Apple ][, which included 3D wireframe animations, which at the time were magical.

> As a child, I really was amused by the demo of GraFORTH on Apple ][, which included 3D wireframe animations, which at the time were magical. I originally wrote GraFORTH ( https://archive.org/details/a2_GraFORTH_1981_Lutus_Paul ) to escape the slow world of integer BASIC on my first computer (an Apple II). Because it relied on large blocks of assembly code to produce nice graphics, it perhaps misled people about wha…

[deleted]

Re: Forth: The programming language that writes itself

#144
post #32
post #5

Many people glorify the simplicity of Lisp as an interpreter, but Forth is similar and underappreciated. Sadly, the only code I've written in Forth is... PostScript. Yeah, PostScript is a dialect of Forth. As a child, I really was amused by the demo of GraFORTH on Apple ][, which included 3D wireframe animations, which at the time were magical.

> As a child, I really was amused by the demo of GraFORTH on Apple ][, which included 3D wireframe animations, which at the time were magical. I originally wrote GraFORTH ( https://archive.org/details/a2_GraFORTH_1981_Lutus_Paul ) to escape the slow world of integer BASIC on my first computer (an Apple II). Because it relied on large blocks of assembly code to produce nice graphics, it perhaps misled people about wha…

I used Graforth, that was so cool! I owe you a beer for pirating it. I also (like most Forth enthusiasts) developed my own Apple ][, based on FIG-FORTH, with its own graphics libraries and PRODOS integration, and used it to write terminal emulators.

Then I discovered Mitch Bradley's Sun Forth (aka ForthMacs, Open Firmware, IEEE 1275-1994), which was originally based on Langton and Perry Forth 83, but has a metacompiler and can target many platforms and word sizes and cpus.

More thoughts and links on Mitch Bradley, Open Firmware and Forth programming:

https://news.ycombinator.com/item?id=21822840

https://github.com/MitchBradley/openfirmware

Has anybody else ever had the dubious experience of using "Cap'n Software Forth"? That's what John Draper wrote [Sl]EasyWriter with (which he wrote on work furlough from the Alameda County Jail). During the 90's SF Raves scene I would always carry some emergency tobacco around as repellent, just in case I ran into him.

https://en.wikipedia.org/wiki/EasyWriter

http://www.art.net/~hopkins/Don/lang/forth.html

>The first Forth system I used was Cap'n Software Forth, on the Apple ][, by John Draper. The first time I met John Draper was when Mike Grant brought him over to my house, because Mike's mother was fed up with Draper, and didn't want him staying over any longer. So Mike brought him over to stay at my house, instead. He had been attending some science fiction convention, was about to go to the Galopagos Islands, always insisted on doing back exercises with everyone, got very rude in an elevator when someone lit up a cigarette, and bragged he could smoke Mike's brother Greg under the table. In case you're ever at a party, and you have some pot that he wants to smoke and you just can't get rid of him, try filling up a bowl with some tobacco and offering it to him. It's a good idea to keep some "emergency tobacco" on your person at all times whenever attending raves in the bay area. My mom got fed up too, and ended up driving him all the way to the airport to get rid of him. On the way, he offered to sell us his extra can of peanuts, but my mom suggested that he might get hungry later, and that he had better hold onto them. What tact!

As annoying and creepy as he is, he does have a lot of great stories to tell...

Calling Richard Nixon:

https://news.ycombinator.com/item?id=22671636

Execute Some "Get High" Instructions:

https://news.ycombinator.com/item?id=39575987

Forging BART Cards:

https://news.ycombinator.com/item?id=34568618

Re: Forth: The programming language that writes itself

#145
post #73

Earlier quoted context omitted.

Well, I feel that lot of code is written again and again, just in different languages. If we could automatically compare and translate different implementations, I think it would be beneficial for finding bugs. Everytime somebody comes up with a new programming language, I am like, yeah, so you added these abstraction, just in a different syntax. I think people who come up with new languages should implement the prim…

Racket is at least related to the kind of metalanguage system you're talking about. I've never actually done it, but to implement a new "#lang" in Racket, your job is essentially to write a "reader" for it that transliterates it to the classic Schemey Racket language. Libraries written in one #lang can then be called from one another (or not, if that's what you want -- a lot of the point of this in Racket is building…

But why stop at Racket? Why not reduce the needed primitives even further down to LC?

Re: Forth: The programming language that writes itself

#146
post #73

Earlier quoted context omitted.

Well, I feel that lot of code is written again and again, just in different languages. If we could automatically compare and translate different implementations, I think it would be beneficial for finding bugs. Everytime somebody comes up with a new programming language, I am like, yeah, so you added these abstraction, just in a different syntax. I think people who come up with new languages should implement the prim…

> Everytime somebody comes up with a new programming language, I am like, yeah, so you added these abstraction, just in a different syntax. I got this feeling too, until I started to explore languages outside of the C/Algol-like syntaxes. There is a wide range of languages out there, from array languages to lisps, and they don't give me the feeling of "just a different syntax" but actually changed the way I think. So…

> assuming everyone would use the same hardware, same environment and same workflows

They don't have to. I would ideally represent HW, OS and compiler in the LC as well. Then primitives of the language that could be proven to be HW/OS/compiler independent could be abstracted and readily translated. For the ones that could not - well you have exact description of what the differences are.

Re: Forth: The programming language that writes itself

#147
post #95

Earlier quoted context omitted.

Simple pure concatenative languages map quite well though [1]. [1] https://github.com/tromp/AIT/blob/master/ait/mlatu.lam

Joy, right? Not Forth. Conversion between spagetti stacks and pure stack programming(in which the stack contains numbers and no GC) has a massive translation cost if you go from LC to Forth and back.

Forth is an imperative language and as such you will have to model memory state (at least) somehow, if you want to use purely functional language as a representation. But that's the cost of doing business.

The thing is though, you don't translate to LC for performance, but for understanding. At any point, the LC evaluator might recognize a known subterm and replace it with a known equivalent. Depending on the goal, that might help to improve evaluation performance (skip known steps of beta reduction), reduce memory consumption (reduce size of the term), or improve readability (refactor code to use better known abstractions).

Re: Forth: The programming language that writes itself

#148
post #32
post #5

Many people glorify the simplicity of Lisp as an interpreter, but Forth is similar and underappreciated. Sadly, the only code I've written in Forth is... PostScript. Yeah, PostScript is a dialect of Forth. As a child, I really was amused by the demo of GraFORTH on Apple ][, which included 3D wireframe animations, which at the time were magical.

> As a child, I really was amused by the demo of GraFORTH on Apple ][, which included 3D wireframe animations, which at the time were magical. I originally wrote GraFORTH ( https://archive.org/details/a2_GraFORTH_1981_Lutus_Paul ) to escape the slow world of integer BASIC on my first computer (an Apple II). Because it relied on large blocks of assembly code to produce nice graphics, it perhaps misled people about wha…

Thank you for one of the coolest things I'd ever seen back then... The space shuttle animation was pure magic to me back then.

Re: Forth: The programming language that writes itself

#149
post #32

Earlier quoted context omitted.

> As a child, I really was amused by the demo of GraFORTH on Apple ][, which included 3D wireframe animations, which at the time were magical. I originally wrote GraFORTH ( https://archive.org/details/a2_GraFORTH_1981_Lutus_Paul ) to escape the slow world of integer BASIC on my first computer (an Apple II). Because it relied on large blocks of assembly code to produce nice graphics, it perhaps misled people about wha…

> I originally wrote GraFORTH Oh really? Given you were around at about the correct time period, could you hazard a guess at what dialect this very old Forth game from Byte magazine was written in? https://github.com/RickCarlino/Cosmic-Conquest-1982 It has some graphics commands in that I couldn't find in any other version of Forth on the Apple II. I'm a little outside the Apple II demographic, since they didn't real…

> could you hazard a guess at what dialect this very old Forth game from Byte magazine was written in?

The writeup identifies the original Forth source/version as most likely FIGForth '78, so I assume that's correct. This doesn't mean it has no code borrowed from elsewhere, and we might never sort that out.

I should add that Forth has the property that you go from nothing to writing programs pretty quickly, because it's all based on RPN (like HP calculators) and there's very little infrastructure required to create a usable environment -- unlike virtually every other language I've created/used.

My having been a fan of HP calculators beforehand played a part in getting me started with Forth -- RPN was an aspect of Forth I didn't have to learn before getting started.

Remember also that the 6502 (the Apple II processor) had a rather easily understood assembly instruction set, which meant any adept 6502 programmer could basically decode and grab other people's work without needing a source listing. No longer true for modern processors.

Guess how we updated each other during program development and updates? Ready? 5 1/4 inch floppy disks stuffed into big manila envelopes, then snail-mailed. No, not making this up.

Re: Forth: The programming language that writes itself

#150

I was captivated by the August 1980 issue of Byte magazine, which had a cover dedicated to Forth. It was supposed to be easy to implement, and I imagined I might do that with my new KIM-1 6502 board. Alas, the KIM-1 was lost when I went to college, and life forced me down different pathways for the next 45 years. About a year ago I finally began to work on my dream of a Forth implementation by building a Forth-based…

https://archive.org/details/byte-magazine-1980-08
Post reply on HN