top | item 10729266

Shem: A Haskell-Derived Compile-to-JavaScript Lisp

117 points| rwosync | 10 years ago |github.com | reply

36 comments

order
[+] chenglou|10 years ago|reply
Man AST editors are so hard to get right. I've tried many of them, this one (Golem) included, but it's just very hard to kill the habit of wanting to move around/delete single text characters. Because of that, many people give up and don't move past the initial stage.

I think what we need is "Elm error messages" (http://elm-lang.org/blog/compiler-errors-for-humans) for AST editors. Take paredit for example. If you're trying to delete a closing parenthesis, instead of refusing to do so and silently fail, display a tooltip that explains why such action is disallowed, and a list of (heck, hard-coded even, like some Elm errors) likely actions the user's trying to take. Deleting the list? Deleting just a token? Show the keybindings. Or even automatically pick the most likely action after a second invalid delete attempt.

I actually believe the constraints imposed by structural editing can be very beneficial (again, see paredit which helps your program stay syntactically valid). But constraints are good when they're visible. You can exhaustively check what's there. Constraints are frustrating when they're invisible and you repeatedly accidentally stumble against them.

(Ideally you'd also provide a free-form mode where you can edit things as plain text. But from personal experience I'd just go back to this instead of learning the AST editing keybindings.)

[+] lomnakkus|10 years ago|reply
This makes it near-useless for me as well.

The thing I'm wondering is why people are so obsessed with this kind of AST editing. I don't find that code text entry speed is the limiting factor for any of my coding. The limiting factor is usually a) understanding the problem well enough, and b) understanding the existing code well enough. A good IDE with symbol/type and usage lookup usually suffices for the latter.

EDIT: If the point here is to prevent invalid ASTs, then I don't really see how much that helps. The number of invalid programs with valid ASTs is going to be huge, so you need good error handling anyway.

[+] CMCDragonkai|10 years ago|reply
The AST editor golem is really cool. But the habit of wanting to move around and delete single text characters can be trained out of you, just like people who use vim.
[+] baghead66|10 years ago|reply
I prefer "Eliza error messages". That said, congrats.
[+] xixixao|10 years ago|reply
The irony of the project you've worked on for a year hitting HN while you're sitting on an 11 hour flight... AMA if you wish
[+] sooheon|10 years ago|reply
No questions, just want to say as a clojure/emacs fan this is right up my alley, and you really blew me away.

Actually, I do have a question: do you have a blog or thought dump I can read?

[+] provemewrong|10 years ago|reply
This is one of the most Hacker News titles I've seen.
[+] yenda|10 years ago|reply
My brain is still buzzing, it's a magic hacker buzzword combo ! Impressive work though
[+] techdragon|10 years ago|reply
So it came to pass that Haskell begat a Lisp, who in turn begat many children unto the clan of JavaScript.

The title translates to "biblical speak" pretty well haha

[+] jamesfisher|10 years ago|reply
> The semantics are based on Haskell

Are the semantics available anywhere? I've been waiting for someone to create a Lisp with pure/monadic IO, but I don't know whether Shem is what I imagine.

[+] daxfohl|10 years ago|reply
Is it lazy evaluated? Tail-call optimized?
[+] izym|10 years ago|reply
Evaluates like PureScript, so no, it's eagerly evaluated. Not quite sure about the TCO part though.
[+] reycharles|10 years ago|reply
How is this 'Haskell-derived'?
[+] kornish|10 years ago|reply
From the README:

"Shem is a new compiled-to-JS, statically typed, pure-by-default functional programming language. The semantics are based on Haskell but the language evaluates strictly in a similar way to PureScript."

The document, unfortunately, doesn't go deeper into what about the semantics are derived from Haskell. A better HN title might be "Shem: a Statically Typed Compile-to-Javascript LISP".