News for hackers. Stuff that matters.
Re:Goodbye “undefined is not a function” by jordanthoms on Sunday February 22, 2015 @04:57PM (#9091327)
This is one of my pet peeves with most languages' error messages - e.g in Ruby: 2.2.0 :001 > a = nil; b = " "; c = "a"; 2.2.0 :002 > a + b + c NoMethodError: undefined method `+' for nil:NilClass from (irb):2

It would be trivial to tell me what the name of the nil variable was - in this case it's obvious, but it's often not.

Re:Goodbye “undefined is not a function” by adrusi on Sunday February 22, 2015 @05:13PM (#9091412)
Except in Ruby, that error is raised by `NilClass#method_missing`. `method_missing` gets to know the name of the method being called, and the arguments passed to it, but it deals with the value, not the variable. It wouldn't be "trivial" to report the name of the variable, it would probably involve intercepting all NoMethodErrors raised by NilClass and then dropping into the debugger to know where exactly execution stopped. I'm not sure this is even possible with the current architecture of the Ruby interpreter.
Re:Goodbye “undefined is not a function” by nilved on Sunday February 22, 2015 @05:31PM (#9091503)