News for hackers. Stuff that matters.
Re:Why perl has separate arrays and hashes: It's as if they ... by __david__ on Tuesday June 21, 2011 @02:58PM (#2679939)
> I'm not sure if I'd characterize Javascript's handling of arrays and hashes as conflated.

Insomuch as [] and {} produce arrays and object, yes, you are correct. But those objects are strikingly similar and the functions in each prototype work on the other. To the outside observer, only the length bit works differently.

I can do:

  a = new Array();
  a["b"] = 1;
  for (x in a) { /* x will be "b" here*/ }
  a.length /* 0 */
and

  d = {0:"a",1:"b",2:"c",3:"d",length:4}
  Array.prototype.slice.call(d, 1,3) /* returns ["b", "c"] */
That's conflated a little bit.

There are no comments on this comment yet.