14 ms·
1991 – a server-side web framework written in Forth
- ushouldban 8y agoWow, really cool. You should ban.
- gmfawcett 8y agoThis is charming. A microframework in a scant 480 lines of code, plus a postmodern manifesto on historisity -- what's not to love! I can't wait to read the slew of "Why we switched from <web-framework> to 1991" blog posts.
- giancarlostoro 8y agoMaybe migrating from bashttpd: https://github.com/avleen/bashttpd https://github.com/avleen/bashttpd
- monocasa 8y agoOr Cobol on Wheelchair https://github.com/azac/cobol-on-wheelchair https://github.com/azac/cobol-on-wheelchair
- arethuza 8y agoI once encountered an actual real live business application that included a web server written in VB6....
- Cthulhu_ 8y agoI can see how that would go; I mean "how to serve static files" is one of the first things that you can learn when doing e.g. NodeJS.
- arethuza 8y agoI never did find out the real reason - I suspect (as it was a relatively small business that had been acquired) that it was because they were too cheap to pay for a server edition of Windows.
- giancarlostoro 8y agoThe only sucky things about VB6 was threading wasn't a regular language feature. You could get to it through the WinAPI but that's not organic enough for most VB programmers. One thing I do miss about VB6 is that you didn't need an entire runtime to build a GUI.
- PopsiclePete 8y agoI wouldn’t say that was the only thing...error handling was a mess and I don’t even want to remember what I had to do to make a hash table - there were definitely low level calls to RtlMoveMemory and such.
- nudpiedo 8y agoI can see that happening: "the deployment was a piece of cake". What says the project about security? "Only rudimentary input handling. We would not be running this on a public machine." What will the hipsters say? "time to market"
- qbaqbaqba 8y agoDo you know what runs HN?
- tlrobinson 8y agoOr https://github.com/tlrobinson/martin.sh https://github.com/tlrobinson/martin.sh
- achillean 8y agoLooks like there are a few people actually running it :) https://www.shodan.io/search?query=http+200+server+slash+bin+slash+bash https://www.shodan.io/search?query=http+200+server+slash+bin...
- mopeloi 8y agoAs someone with a similarly retro web framework ( https://fortran.io https://fortran.io ), as far as I know, no one has switched to it. I have gotten a few serious inquiries from coders in the sciences or who are making use of their old Fortran skills... but only a very few in two years.
- vvpan 8y ago1991 - the year punk broke.
- ithkuil 8y agoCool. Any decent implementation for client side forth in the browser so I can do some good old Asynchronous Forth And staX?
- stefano 8y agoI wrote a Forth interpreter for WASM some time ago: https://github.com/stefano/wasm-forth https://github.com/stefano/wasm-forth It's not production ready and it's missing a good JS interface, but you can use it to run Forth code in the browser with a basic console interface.
- vim-guru 8y agoI know Karsten Schmidth made a browser REPL you can try. I don't know the address, but I think he mentions it in this talk: https://juxt.pro/blog/posts/XT16-karsten-schmidt.html https://juxt.pro/blog/posts/XT16-karsten-schmidt.html
- justaaron 8y agocool!
- jdmoreira 8y agoBesides the framework itself the website is glorious. Kudos!
- oneplane 8y agoWhy hasn't someone made a Go and Forth combination yet?
- fouc 8y agoWhat makes you think Go and Forth go well together?
- deleted 8y ago[deleted]
- kstrauser 8y agoEveryone knows you Go Forth and multiply.
- MaxBarraclough 8y agoStrictly speaking, you're meant to GO FORTH AND MULTIPLY.
- WrtCdEvrydy 8y agoForthGo? Sounds like it isn't that good if it took them four tries.
- c3534l 8y agoI've always thought Haskell and Forth would make an amazing combo.
- mempko 8y agoI love postmodern software
- DonHopkins 8y agoAnd postfix software!
- hestefisk 8y agoTo stay true to this claim it should’ve been written in Perl.
- brlewis 8y agoEven people who love Perl don't love 1991 Perl.
- fouc 8y ago> Hence developers working on new projects while still coding in decades-old text editors. They write the future in the past and are made present in so doing. Deep
- hestefisk 8y agoPostmodern. Just like Perl.
- kstrauser 8y agoThat's beautiful. Well done!
- quickthrower2 8y agoNice. I wonder what the threading model is? Process per request? Thread per request? NodeJS style?
- brlewis 8y agoI think it's single-threaded synchronous. https://github.com/urlysses/1991/blob/1991/1991.fs#L469 https://github.com/urlysses/1991/blob/1991/1991.fs#L469 https://github.com/forthy42/gforth/blob/master/unix/socket.fs#L439 https://github.com/forthy42/gforth/blob/master/unix/socket.f...
- RodgerTheGreat 8y agoOne process, one HTTP request at a time, buffering excess requests in a queue of up to 255 requests. Here's the main "event loop": : start-server { server client } begin server 255 listen server accept-socket to client client read-request prepare-response client send-response again ; I think this word's definition should be fairly easy to follow even if you aren't familiar with Forth.
- lichenwarp 8y agoAnd I thought I was horrible at choosing domain names lol
- andrelaszlo 8y agoIt would have been cool to serve this from the raw ip like https://1.9.9.1 https://1.9.9.1 :P It's actually responding to pings, seems to be in Malaysia.
- gammateam 8y agocertain target audiences don't in domain names anymore, they just follow links so it often doesn't really matter.
- numbers 8y agoLove the note at the end, rings true with me.
- stevejohnson 8y agoI really like the commitment to retro aesthetics. Last weekend I made an "imaginary astronomy" web app with nearly pixel-perfect Windows 95 theming. :-) http://steveasleep.com/keplverse/ http://steveasleep.com/keplverse/ Forth still seems like a language worth learning, not for practical reasons, but for technohistorical context. Maybe my first project should be a sqlite library?
- int_19h 8y agoThat's a nice one, but why not use MS Sans Serif as a font where available, for maximum effect?
- stevejohnson 8y agoBecause I'm on a Mac and wouldn't be able to test it. :-D Patches accepted here: https://github.com/irskep/keplverse https://github.com/irskep/keplverse I also blogged about the algorithm, if that's of interest: https://blog.steveasleep.com/using-data-from-the-kepler-mission-to-scientifically-imagine-star-systems https://blog.steveasleep.com/using-data-from-the-kepler-miss...
- sansnomme 8y agoThink you can make it into a CSS framework or Bootstrap theme?
- laputan_machine 8y agoThat's really nice. I have a stupid amount of nostalgia for the Win95/NT theme.
- nickcw 8y agoThat is a masterpiece of Forth programming! I particularly enjoyed this section from the template renderer which made me think... Return stack manipulation - that's playing with fire. And also - wow Forth is not much higher level than assembly, and gosh, I don't think I could have written that without writing some stack diagrams! 2dup s" $>" search if \ Check to see if there's a closing tag $>. 2 - \ Add the close tag to the search result. nip \ Save the end position of $>. dup >r - \ Reduce the string to <$ ... $>. evaluate \ Run user's code (maybe a bad idea?). r> \ Retrieve our saved end position of $>. r> r> \ Retrive the addr u from start of loop iter. rot \ Bring end $> to stack top. over >r \ Store the real string's length. - \ Subtract end $> from u to get the pos from top r> swap \ that we'd like to strip away. Restore saved u. /string \ Drop top of the string until the end of $>. 0 \ Keep looping. Thanks for the trip down memory lane!
- james_s_tayler 8y agoI like the (maybe a bad idea?) comment.
- RodgerTheGreat 8y ago
- pmarreck 8y agoForth must be lightning fast albeit single-threaded... has there been any work on a multithreaded Forth? Compiling to BEAM VM might be an option for (not fast) implementation...
- madhadron 8y agoConsidering that some Forth implementations were custom hardware that directly implemented the language semantics, it was often quite fast, yes. Most of the bigger Forth systems (gForth, WinForth, BigForth) have some form of threading/task management. The smaller ones, which are often the ones expecting to run natively on microcontrollers with no operating system, expect you to write your own if you need it.
- tdeck 8y agoIt seems it's supported in some FORTHs: https://stackoverflow.com/questions/32736552/does-forth-support-multithreading https://stackoverflow.com/questions/32736552/does-forth-supp... Also of interest - Chuck Moore's* current work is on such a parallel architecture ASIC that uses FORTH: http://www.greenarraychips.com/ http://www.greenarraychips.com/ *Chuck Moore is the creator of FORTH
- rwmj 8y agoA naive (ie. threaded[1]) Forth implementation will be slow because the jump between each instruction is a very effective way to defeat branch prediction. Of course this doesn't apply to "real Forth" which is compiled into machine code or even less naive Forths which can do inlining, but there are many hobbyist Forth implementations (because they're so easy to write) where this will still be true. If you're interested I wrote a naive literate Forth implementation which can do inlining: http://git.annexia.org/?p=jonesforth.git;a=blob;f=jonesforth.S http://git.annexia.org/?p=jonesforth.git;a=blob;f=jonesforth... http://git.annexia.org/?p=jonesforth.git;a=blob;f=jonesforth.f http://git.annexia.org/?p=jonesforth.git;a=blob;f=jonesforth... [1] "Threaded" in this sense means https://en.wikipedia.org/wiki/Threaded_code https://en.wikipedia.org/wiki/Threaded_code not multithreading.
- gmfawcett 8y ago
- jholloway7 8y agoCan this recreate trying to figure out a way to host a web server in 1991?