Run the program: var a=1; a (); JSC: TypeError:a is not a function V8 & SpiderMonkey: TypeError:a is not a function In the error message,'a/n' is output as the variable name but the really variable name is 'a'.I think it may be a bug.
Safari, Firefox and Chrome return the same error message.
but indeed Firefox and Chrome normalizes the output to avoid the return.
Full Safari output ``` TypeError: a is not a function. (In 'a ()', 'a ' is 1) ``` I wonder if it would be better to actually shows the output as: ``` TypeError: a\n is not a function. (In 'a\n()', 'a\n' is 1) ```
'\n' is illegal in variable name and function name.'var a\nb=1' will throw a SyntaxError.So print 'TypeError: a\n is not a function.' may be not a good idea.It regard 'a\n' as a variable name. But '\n' is meaningless in the end of variable name and function name and will be ignored. If running the following program: var a =1; print(a); print(a ); a=2; print(a); print(a ); It output: 1 1 2 2 So during compilation,'\n' in the end of variable name and function name will be ignored.The '\n' of variable name 'a\n' will be ignored and 'a\n' is regarded as 'a'. I think 'TypeError:a is not a function' is better.
Yes agreed. But how do we help the developer to discover the error. :) That's where I was coming from.
All I know is that I can report the bug in this website.Isn't it the bug tracking system for JSC?
<rdar://problem/99064631>