7 ms·
Hello everybody, author here. I hope you enjoy my tiny project. Regarding language, I chose Javascript for three reasons: - the (ab)use of `eval` lets you do
by gabrielflorit 8y ago
Hello everybody, author here. I hope you enjoy my tiny project.
Regarding language, I chose Javascript for three reasons:
- the (ab)use of `eval` lets you do all sorts of sorcery, like instant evaluation
- the JS Redux library makes it easy to work with state, and I couldn't have implemented SCRIPT-8's time-traveling debugger without it
- I dream in Javascript
I love Lua's small footprint, and very early on I considered writing SCRIPT-8 in MoonScript, which compiles to Lua and has gorgeous syntax. Maybe some day.
And yes, my fantasy computer is definitely not the only open source project, there's several out there, and probably all of them are more stable than mine. Go check them out.
- brianobush 8y agoThanks to the pointer to Bret Victor's video on Inventing on Principle. Nice to see you brought some of his concepts into SCRIPT-8.
- danielvf 8y agoThis is amazing! I'll be letting my kids play with it tomorrow! And JS is a great choice.
- rendaw 8y agoDo cassettes have a size limit? AFAIK all (most?) the other fantasy consoles do but I didn't see anything on your page. A lot of the cool features others mentioned seem like they would be overkill on a small codebase.
- gabrielflorit 8y agoThey don't now, but that is coming. The "SHOW CASSETTE SIZE" button under the live-preview screen shows you the current size / compressed size. But it doesn't prevent you from making a huge cassette - not yet.
- curioussavage 8y agoGlad to find another moonscript fan!
- exitcode00 8y agoVery creative project! Did you experience any issues doing pseudo-low-level programming with Javascript's lack of typing system or definite integer/float data-types?
- gabrielflorit 8y agoThank you, and no issues, because I didn't implement any low-level programming. I use React/Redux and Canvas 2D, with some custom shape drawing to avoid antialiasing (e.g. Bresenham's algorithm).
- nullzzz 8y agoThis looks fun! Would be great to have something that catches runtime errors and highlights them in the source code. Then, of course, code completion etc to make it easy to find stuff. I started working on a bit similar project some years ago (I unfortunately abandonded it...) but I got one thing right: the ability to highlight the erroneous line. See http://write-a-game.herokuapp.com/ http://write-a-game.herokuapp.com/ and try to call a non-existent function.
- nullzzz 8y agoHere's the stack trace parser used. It tries to extract the line number and error message from an Error object. Sorry for the coffeescript! https://github.com/raimohanska/write-a-game/blob/8d2111e2372c17f17b3e238093fd8131d5cdbabb/editor-app/parse-stack.coffee https://github.com/raimohanska/write-a-game/blob/8d2111e2372...
- gabrielflorit 8y agoGood idea. This would be useful for sure.
- vanderZwan 8y ago> very early on I considered writing SCRIPT-8 in MoonScript, which compiles to Lua and has gorgeous syntax. Maybe some day. I know it's no longer considered hip these days, but why not support CoffeeScript? It's easy to compile to JS on the client-side, so support should be much simpler than Lua or MoonScript. You could steal the trick TIC-80 uses to support MoonScript and say that starting a cassette with the string "use CoffeeScript" marks it as a CS file. Then it's "just" a matter of an if(String.startsWith("use CoffeeScript\n"))-check followed by an intermediate string-to-string compilation step, right? https://coffeescript.org/ https://coffeescript.org/
- owens99 8y agoI wish more people used CoffeeScript and supported it. The syntax makes me so happy
- gchamonlive 8y agoCoffee Script is hell. Apart from https://github.com/usefulthink/coffeescript-from-hell/blob/master/README.md https://github.com/usefulthink/coffeescript-from-hell/blob/m..., it takes the worst approach to spaces as syntax, because it doesn't enforce consistency, so with many devs you can end up with a file with two, four spaces, tabs all compiling but easily breaking. It has features their own syntax checker recommend not using, like defining objects without curly braces (which I think shouldn't even be a feature, but it was once so backwards compatibility) Coffee Script tries to be beautiful without straying too far from Javascript and it ends up being an easily broken mess. I would then recommend either typescript or purescript.
- vanderZwan 8y agoHonest question: pointing out programming design warts that allow for WAT-level code[0] is perfectly valid, and I obviously prefer elegantly designed languages. Having said that, how realistic are the odds of being bitten by these issues when using CoffeeScript? Also, if our point of comparison is Lua and MoonScript, how do those compare? EDIT: regarding TypeScript and PureScript, can those be compiled in the browser? By which I mean, I'm sure they can technically but do not-too-heavy implementations of such exist? [0] https://www.destroyallsoftware.com/talks/wat https://www.destroyallsoftware.com/talks/wat
- tyingq 8y ago"I love Lua's small footprint, and very early on I considered writing SCRIPT-8 in MoonScript, which compiles to Lua" Something similar, in Lua: https://liko-12.github.io/ https://liko-12.github.io/
- AnIdiotOnTheNet 8y ago> I dream in Javascript You have my deepest sympathies.