Re: Will FP ever have a great Stack Trace story in JS?

2015-09-18 Thread Allen Wirfs-Brock
Note that making this behavior dynamic means that every assignment operation would have to explicitly check whether or not its RHS dynamically evaluated to a function object, and if so whether the function already had a name property. That's real, measurable runtime cost being added to every

Re: Will FP ever have a great Stack Trace story in JS?

2015-09-18 Thread Alexander Jones
Personally I'm already slightly weirded by the static behaviour - doing this dynamically would result in cases where a function which is otherwise anonymous would happen to claim the first name of many that it's assigned to throughout its lifetime. This would actually be observable at runtime as

Re: Will FP ever have a great Stack Trace story in JS?

2015-09-16 Thread James Kyle
Okay, let's break this down. Your example stack trace is really not a bad story. > Error: Invariant Violation: createClass(...): Class specification must > implement a `render` method. >     at invariant >(/Users/jasonkuhrt/code/test/node_modules/react/lib/invariant.js:42:15) >     at

Re: Will FP ever have a great Stack Trace story in JS?

2015-09-16 Thread Jason Kuhrt
Also I disagree with your assessment that I should go talk to the vendors. For example Axel R.’s recent post on Function names http://www.2ality.com/2015/09/function-names-es6.html states in Section 2 the case where there is no name. I

Re: Will FP ever have a great Stack Trace story in JS?

2015-09-16 Thread Caitlin Potter
Not quite, the mechanism which does this in the spec is SetFunctionName (http://www.ecma-international.org/ecma-262/6.0/#sec-setfunctionname ), and it only works for specific syntactic constructs (eg, `foo = function() {}` ->

Re: Will FP ever have a great Stack Trace story in JS?

2015-09-16 Thread Jason Kuhrt
Oh shoot, that’s my misunderstanding of his response I guess. So back to square zero. > On Sep 16, 2015, at 9:44 PM, Caitlin Potter wrote: > > Not quite, the mechanism which does this in the spec is SetFunctionName >

Re: Will FP ever have a great Stack Trace story in JS?

2015-09-16 Thread Jason Kuhrt
For some reason the email I wrote was cut off. In practice the stack trace gets worse, my test was just too easy. The last stack trace was based around using compose from ramda. The stack trace result was: ``` Error: Invariant Violation: createClass(...): Class specification must implement a

Will FP ever have a great Stack Trace story in JS?

2015-09-16 Thread Jason Kuhrt
For example, today, a stone from the bedrock of FP: > ``` > let compose = (b, a) => (...as) => b(a(...as)) > ``` will cause a JS Stack Trace to go from something useful (space around useful line) like: > ``` > Error: Invariant Violation: createClass(...): Class specification must > implement

Re: Will FP ever have a great Stack Trace story in JS?

2015-09-16 Thread Axel Rauschmayer
> Not quite, the mechanism which does this in the spec is SetFunctionName > (http://www.ecma-international.org/ecma-262/6.0/#sec-setfunctionname > ), and > it only works for specific syntactic constructs (eg, `foo = function()