satyr / coco

Unfancy CoffeeScript
http://satyr.github.com/coco/
MIT License
498 stars 48 forks source link

unexpected result when using -bps to compile a small snippet #233

Closed larroy closed 11 years ago

larroy commented 11 years ago

cat|coco -bps I = (x) -> x [Function]

Output should be: (function(){ var I; I = function(x){ return x; }; }).call(this); ~

vendethiel commented 11 years ago

-bps means --bare --print --stdin. So it doesn't compile and won't add the iife wrapper (--bare). If you want to compile, use -bpcs

satyr commented 11 years ago

coco's --print works more like node's and (unlike coffee) doesn't imply --compile.

$ coco -pe 0
0

$ node -pe 0
0

$ coffee -pe 0
(function() {
  0;

}).call(this);
larroy commented 11 years ago

Thanks. I was just trying to migrate to coco from coffee and didn't found a clear syntax reference. These discrepancies led me to think that it wasn't working properly. I think if there could be more documentation adoption could be improved. Is there a way to help for the novice in this respect?

Pedro.

satyr commented 11 years ago

Feel free to tweak the wiki and/or pull-req for #232 if you dare.