gkz / LiveScript

LiveScript is a language which compiles to JavaScript. It has a straightforward mapping to JavaScript and allows you to write expressive code devoid of repetitive boilerplate. While LiveScript adds many features to assist in functional style programming, it also has many improvements for object oriented and imperative programming.
http://livescript.net
MIT License
2.32k stars 156 forks source link

Please document `global import require 'prelude-ls'` #890

Open rrthomas opened 8 years ago

rrthomas commented 8 years ago

I just had a play with LiveScript to show someone learning JavaScript how much more elegantly they could be coding!

It's great, but one thing frustrated me immensely: it took me about half an hour to work out the above incantation to import the entire prelude.

Given that it's so powerful (arguably a large part of the reason to use LiveScript in the first place), could you please foreground the above in the documentation, so users can start playing with LiveScript and its awesome prelude on their own machines as easily as they can in the online web sandbox?

gkz commented 8 years ago

You can use the -d or --prelude flag when starting the REPL - this is documented with lsc --help

rrthomas commented 8 years ago

Thanks for responding. Sorry, I wasn't clear: I was talking about running scripts, not using the REPL.

I found -d quickly, but of course it doesn't work with scripts (as far as I could tell from searching, it used to, but now only works with the REPL, which I also found puzzling).

naturalethic commented 8 years ago

Huh, I always just do:

global <<< require \prelude-ls

rrthomas commented 8 years ago

@naturalethic, exactly! If that were documented obviously and explicitly (rather than having to piece together the fact the -d doesn't work for scripts, that the prelude isn't automatically included in LiveScript, and the syntax you mention above), that would be a great help for those new to Prelude & LiveScript.