larryng / coffeescript-repl

A CoffeeScript interactive console (REPL) as a webpage.
http://larryng.github.com/coffeescript-repl/
ISC License
69 stars 9 forks source link

change `$_` to `_` #1

Open michaelficarra opened 12 years ago

michaelficarra commented 12 years ago

$_ seems like an odd choice. In the official REPL (and in node's), the result of the last evaluation is stored as _.

larryng commented 12 years ago

I chose $ as to not override the popular jQuery's $ nor Underscore.js's . On May 12, 2012 8:26 PM, "Michael Ficarra" < reply@reply.github.com> wrote:

$_ seems like an odd choice. In the official REPL (and in node's), the result of the last evaluation is stored as _.


Reply to this email directly or view it on GitHub: https://github.com/larryng/coffeescript-repl/issues/1

michaelficarra commented 12 years ago

_ is really the proper choice here. I think it's what everyone would expect. We haven't gotten a single complaint for this behaviour in the official REPL:

$ coffee
coffee> _ = require 'underscore'
{ [Function]
  _: [Circular],
  VERSION: '1.3.3',
  /* ... [snip] ... */
  template: [Function],
  chain: [Function] }
coffee> 0
0
coffee> _
0
coffee> 
larryng commented 12 years ago

I agree that _ is what is expected, but Underscore.js came first and I'm not quite ready to break compatibility with the library to save a character. In the future, I'll likely allow the user to change the variable in a setting, once there are Settings.

In the meantime, you are welcome to change it on your own local copy or fork. It is literally a one character change here.

EDIT: With the recent rewrite, make that here.