Hacker News new | ask | show | jobs
by reitzensteinm 2698 days ago
It's probably this one:

https://8th-dev.com/

2 comments

Yea it's this one. The main developer wrote an open source Forth called Reva-Forth awhile back. I think he does a lot of paid development a across various fields from phone app development to embedded work, and machine learning stuff. When he was trying to do phone apps he realized (like most of us) that it is a pain to need to know Java for Android (+ API) and Objective C or Swift for iOS and then there is WinForms or Gtk or WxWidjets for desktop development, so you have to learn a lot of different technologies if you want to write software to run on all major platforms and 8th helps solve most of that problem. 8th is also a Forth, but he has added some features like using JSON as a generic data structure (not generally done in Forth), bundled the C++ JUCE GUI framework and associated licenses, added ODBC/SQLITE/MYSQL support, sound, cross-compilation to many platforms...etc.

Most of my coding needs fall into either general scripting (Python, Powershell, Bash, Perl...etc) or numerical work (Python + Numpy or Julia). 8th seems to be pretty speedy, but Forths in general usually aren't lightning fast due to their stack usage and emphasis and you need really fast code for numeric work. He has made it a priority to work on performance though and continuously adds scientific features like adjacency graphs, so he is on the right track and I'll keep my eyes on it. For general scripting work and utility apps it should work pretty nicely for my needs and distributing a tiny .exe to users with a GUI is nice. I'm not sure how good the file I/O & filesystem support is though (need to look at the doc), because I use those common features a lot. I also need to check if he wrote functions (called words in Forth speech) for web scraping as there is a project I'd like to do where 8th would be ideal.

If you've never seen Forth before, try to keep an open mind with the syntax as it can look alien at first. There are a lot of 8th examples on Rosetta Code and although they are short, it might look like gobblygook if you're not used to thinking about the stack where parameters are popped off and used in functions which then return data to the stack so functions can be chained (kind of like Unix pipes). Leo Brodie's books on Forth (classics and free online) are called "Learning Forth" and "Thinking Forth" and are recommended on HN sometimes.

Thanks a lot for the detailed answer.

I did try out Forth a little, much earlier, and had read some of the Starting Forth book - had bought the hardcover edition, it looked really good, including the cover - dark brown, either was leather or had a leather effect (more likely the latter). And I liked Leo's writing. Will check out 8th at some time. The cross-platform GUI thing with tiny EXE's is a pro (Rebol and Red are similar, except not sure if Rebol supported EXEs, except maybe via 3rd-party tools), although not having good I/O and filesystem support is a con, since a lot of the stuff I do involves file I/O.

Still, it may be worth trying 8th out.

I was going to mention that it is a lot like Rebol and Red in philosophy, but you beat me to it.

Rebol was mostly built by one person (Carl Sassenrath) but has to package the entire interpreter (I think maybe 5 MB) to make an .exe if you have the paid version. Red can already make executables and has made fantastic progress, but it is a larger effort. I check up on Red once a month and think 1.0 will be amazing.

>I was going to mention that it is a lot like Rebol and Red in philosophy, but you beat me to it.

I agree, the philosophies are similar. Minimalism, relying more on your own code than libraries, not generalizing your code for a lot of cases that might not happen, etc.

One thing that puzzles me about Forth, though:

I did read a few books about it (much earlier, and I'm not a language designer, so what I say next could be wrong). Some of them talked a bit about Forth's internal design. I understood from that, that when multiple words (Forth subroutines) are defined, they are "threaded", from which I understood that they are added to a linked list of word definitions. Wondered why it needed to be a linked list. If it was a lookup table of some kind, like a Python dict or a Ruby hash (basically an associative array), looking up word definitions to run them would be faster than in a linked list, which is linear, I'd think.

Edit: I did just have an idea of what the reason for that may be, but will wait a bit to see if anyone replies with their explanation. Hint about my idea: it may have to do with Charles Moore's Forth philosophy - just a guess on my part.

I'm very much a noob when it comes to Forth and I've asked myself the same question before. I think threaded is generic enough to not necessarily dictate the data structure. It more or less means that a word (if it isn't being defined and added to the dictionary (not dictionary as in Python dictionary, but what they call the list of words in Forth)) it will read from the stack, modify the stack, and then call the next word.

Someone on here or on the Forth subreddit should be able to answer though.

>Rebol was mostly built by one person (Carl Sassenrath)

Yes, I had read up about him after learning that he was involved with creating both Amiga OS and then Rebol. Amazing skills. IIRC, I read in some interview of him, that he said he read everything he could lay his hands on, about operating systems, before working on the Amiga OS. Maybe did the same for languages, before working on Rebol.

>but has to package the entire interpreter (I think maybe 5 MB) to make an .exe if you have the paid version.

Interesting. I had not tried the paid version of Rebol, only the free one, and that too, only for a bit, as a hobby. But did like it a lot even then.

>Red can already make executables

Yes, I had tried that, and the executables are really small too, just like the Red interpreter/compiler (in one file!) and the Rebol interpreter.

>I check up on Red once a month and think 1.0 will be amazing.

Likely so. I only hope they do not get off the tracks with their coin-funding stuff, I felt somewhat bad about that, would have preferred if they had gotten funding by more traditional means, but that is just my thoughts.

>maybe 5 MB

Just did a DIR and checked on my PC, the sizes of Rebol Core and Rebol View (bytes):

  303,104 rebol-core-278-3-1.exe
  864,256 rebol-view-278-3-1.exe
The page seems to spend all it's effort promoting how the language is cross-platform. Given the number of cross-platform languages nowadays, I wouldn't think that would be a good selling point (more of a check box).
They do seem to do that a good bit, but is there really a one stop language you can code in from a high level with REPL that can run on several desktop operating systems AND android/iPhone AND em embedded? I'm not aware of any, but that isn't really my area of use. C obviously can, but C is pretty low level and not a super productive language for most. So when they say cross-platform they mean write once and test on your laptop and then cross-compile to all those supported platforms. That is different than Java's write once and run on 3 out of the 6 platforms I mentioned with the bulk (and power I suppose) of the JVM. Note that I'm not saying this or similar philosophical languages like Rebol/Red are the answer to everything as they most certainly are not. If I'm writing something that has to scale to millions of users (something I know next to nothing about), I would likely use Java or Erlang. These languages (8th, Red, Rebol) are really good at allowing you to build reasonably performant applications in a super easy and interactive manner and satisfy a definite need that isn't satisfied by most common enterprise languages. Python is easy to script in, but doing GUI work or trying to deploy is painful. Java requires a nearly painful amount of boilerplate.