coffeescript-repl icon indicating copy to clipboard operation
coffeescript-repl copied to clipboard

change `$_` to `_`

Open michaelficarra opened this issue 13 years ago • 3 comments

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

michaelficarra avatar May 13 '12 00:05 michaelficarra

I chose $_ as to not override the popular jQuery's $ nor Underscore.js's _. On May 12, 2012 8:26 PM, "Michael Ficarra" < [email protected]> 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

larryng avatar May 13 '12 02:05 larryng

_ 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> 

michaelficarra avatar May 13 '12 02:05 michaelficarra

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.

larryng avatar May 13 '12 18:05 larryng