Closed daurnimator closed 6 years ago
@daurnimator This is really awesome btw. I tried taking a poke at it, but I noticed I couldn't do io.read from standard input (there was no io table). Is there another way we turn this into a fnl repl?
I have a WIP stash thing that lets you provide your own IO functions: fnl.repl({read=myread, write=mywrite})
which might be useful for this. I can put together a PR.
That sounds great, as long as we can get input from within fengari.
I tried taking a poke at it, but I noticed I couldn't do io.read from standard input (there was no io table)
Well yeah. In a browser io.read
(which blockingly reads from stdin) doesn't really make sense: what what it read from? The only blocking primitive for input in a browser is prompt()
which isn't going to be nice to use.
Is there another way we turn this into a fnl repl?
The repl is written in lua itself: it should be easy to write a fnl repl in fnl (or lua) if you so choose :) See https://github.com/fengari-lua/fengari.io/blob/master/static/lua/web-cli.lua
In a browser io.read (which blockingly reads from stdin) doesn't really make sense: what what it read from?
This is pretty easy to address if you have coroutines. I wonder if they just haven't gotten around to it yet or if there are technical reasons preventing their implementation of coroutines from working here.
Sure it's easy to read input with coroutines, but io.read
isn't documented to use coroutines: so it's necessary for a user to implement it themselves.
@bakpakin I've got a prototype of this working decently, but I thought it would be nice to have a proper site up at https://fennel-lang.org or something like that to host it on. Thoughts?
Edit: Fengari passes all the Fennel test suite except for require-macros
(which needs io.open
).
Yeah, I suppose I could buy a domain.
@technomancy Is your prototype completely static? Maybe we could host with github pages and just redirect the domain to github. In the long term, it might be better to make a the site in a separate repo.
Yeah, I suppose I could buy a domain.
I could handle the registration and hosting if you don't want to be bothered, but I'd understand if you want to keep it in your name.
Is your prototype completely static? Maybe we could host with github pages and just redirect the domain to github. In the long term, it might be better to make a the site in a separate repo.
From the server side it's all static, yeah. So GitHub pages would work fine. The Fengari Githubissues.
Easy to do with fengari.
For fun, try on https://fengari.io/:
For those that want to copy/paste: