printLine "What's your name?"; let X = readLine in print "Hello, " X "!"
let _ = printLine "What's your name?" in let X = readLine in print "Hello, " X "!"
[ X _ -> X ] (let X = readLine in print "Hello, " X "!") (printLine "What's your name?")
So, there are some tradeoffs. The let sugar means I'll generate one combinator for each semicolon, the semicolon combinator needs to be added to the runtime -which I don't like- but you could, for instance, then fold that semicolon over a list.
Then, should the semicolon combinator be a built-in or generated on the fly? I don't know yet. If I had some kind of optimizing compiler, the compiler would need to know about its definition. A C++ defined combinator is a bit faster but also more a bit work.
Looks like I'll go the whole principled way of going for an explicit AST node for a statement, a transform do desugarize that, and built-in C++ combinator.
For a semicolon.
No comments:
Post a Comment