News for hackers. Stuff that matters.
Re:Highland.js by vlucas on Thursday April 16, 2015 @01:49PM (#9389555)
Nice library, but please don't use the underscore variable (_). So many people use Underscore.js and Lodash.js that it makes reading your docs confusing.
Re:Highland.js by choward on Thursday April 16, 2015 @02:05PM (#9389661)
You can name it whatever you want. That's one of the benefits using a module system.
Re:Highland.js by hamburglar on Thursday April 16, 2015 @02:46PM (#9389989)
So why do we have this trend of using meaningless and ambiguous identifiers, and in particular, why would you do it in example code? I thought that as an industry, we'd moved past the folly of giving things terse and unhelpful identifiers in order to save a few bytes or keystrokes.
Re:Highland.js by killtheliterate on Thursday April 16, 2015 @02:50PM (#9390015)
I think the example code is written using _ to convey the similarity for those familiar with underscore/lodash. In 2015, that's most JS developers.

Just hazarding a guess.

Re:Highland.js by jamesrom on Thursday April 16, 2015 @07:35PM (#9391394)
You notice that all the libraries that do this (underscore, jQuery, Lodash, et al.) offer features that are almost language features. Things so useful but generic that they could almost be integrated into the language syntax.

In this case, there's also the problem that 'Stream' is already used by node.

Re:Highland.js by hamburglar on Thursday April 16, 2015 @08:55PM (#9391705)
> In this case, there's also the problem that 'Stream' is already used by node.

Haha, well, your grandparent would like you to know that's no reason to avoid a particular name. Module system! ;)

  > var BoringStream = require('stream');
  > var Stream = require('highland');
Or if we like special chars, we could get really cute:

  > var $tream = require('highland');
It's like Stream, but, you know, blingier.
Re:Highland.js by random28345 on Thursday April 16, 2015 @02:23PM (#9389822)
Just as you wouldn't use multiple libraries that bound a CSS selector function to the $ variable, I don't think you'd use underscore and lodash in the same javascript code. Similarly, highlandjs looks to supplant the underscore idioms with stream semantics, and you wouldn't mix both libraries in the same codebase.
Re:Highland.js by msane on Thursday April 16, 2015 @05:33PM (#9390869)
Yeah that's basically what his point is. Except you misunderstood to interpret any suggestion that people use underscore and lodash together.
Re:Highland.js by 91bananas on Thursday April 16, 2015 @02:38PM (#9389934)
While I can grant that it does seem to solve a lot of the same problems as underscore and lodash, this is just asking for confusion and complication down the road. You shouldn't make a decision that makes things hard for people to deal with in the future if they choose to use your product. There is well established meaning now to $ and _ in js land, pick another identifier.
Re:Highland.js by random28345 on Thursday April 16, 2015 @04:43PM (#9390651)
I still think the collision with underscore and lodash is intentional and appropriate. It makes a statement saying, "this library is designed to supplant underscore. Do not use underscore and this library together".
Re:Highland.js by DiThi on Friday April 17, 2015 @02:32AM (#9392532)
> Do not use underscore and this library together

Together in the same module. One can port one module at a time. It's what I do in my current job, each module can use a different set of technologies and we don't have to port everything at once.

Re:Highland.js by maemilius on Thursday April 16, 2015 @04:12PM (#9390498)
I'm not certain I understand how their use of _ is any different from Lo-dash or Underscore's use of the variable. Just because they're not first to the party doesn't mean they can't hop on the established semantics.

Their use of _ actually made it easier for me to follow their examples.

Re:Highland.js by deif on Thursday April 16, 2015 @04:14PM (#9390508)
I think that it's pretty reasonable for a similar library to use the same character if the syntax is similar. As an example, the Domtastic library copies the jQuery syntax literally, allowing an easy transition for new users.

It also makes users aware that the library is likely to cover aspects of the other, so they should carefully consider if they really want to include the new one.

Re:Highland.js by nailer on Thursday April 16, 2015 @06:18PM (#9391069)
$ is used for doc.QS or doc.QSA pretty frequently these days
Re:Highland.js by slang800 on Friday April 17, 2015 @12:11AM (#9392228)
I agree with not using the underscore character, while Underscore/Lodash are still popular. Personally, I do `H = require('highland')`, whenever I'm using it.
Re:Highland.js by ceedan on Thursday April 16, 2015 @03:04PM (#9390107)
For real. Highland should just use an H.
Re:Highland.js by spencera on Thursday April 16, 2015 @07:42PM (#9391425)
That's exactly what I use, var h = require('highland');
Re:Highland.js by mynegation on Thursday April 16, 2015 @04:48PM (#9390664)
Or a Greek capital letter Lambda: Λ

Λ(['1', '2', '3'])

Re:Highland.js by tericho on Thursday April 16, 2015 @10:49PM (#9392020)
Is that a valid variable name? Would that mean Λ is unicode?
Re:Highland.js by mynegation on Friday April 17, 2015 @10:25AM (#9394455)
It is a valid Unicode letter so should be acceptable in EcmaScript 5.
Re:Highland.js by jamesrom on Thursday April 16, 2015 @07:43PM (#9391432)
How does one type that?
Re:Highland.js by iyn on Thursday April 16, 2015 @10:41PM (#9392007)
Like this: Λ ;)

Windows: Alt+x 03BB

Linux: Ctrl+Shift+u 03BB (still pressing Ctrl+Shift)