Skip to content

make deepEq work in strict js.#289

Merged
gkz merged 1 commit into
gkz:masterfrom
clkao:master
Mar 20, 2013
Merged

make deepEq work in strict js.#289
gkz merged 1 commit into
gkz:masterfrom
clkao:master

Conversation

@clkao

@clkao clkao commented Mar 19, 2013

Copy link
Copy Markdown
Contributor

No description provided.

@vendethiel

Copy link
Copy Markdown
Contributor

While I think about it, is there any reason we aren't writing those in LS ? Is Function.toString that evil ?

@michaelficarra

Copy link
Copy Markdown
Contributor

Function.toString is 110% evil. Its behaviour is unspecified. That's worse than eval.

@clkao

clkao commented Mar 20, 2013

Copy link
Copy Markdown
Contributor Author

I think the main issue with Function.toString is closed-over variables, otherwise it's quite useful.

gkz added a commit that referenced this pull request Mar 20, 2013
make deepEq work in strict js.
@gkz gkz merged commit 5d1b1e7 into gkz:master Mar 20, 2013
@michaelficarra

Copy link
Copy Markdown
Contributor

@clkao: But you can't rely on it at all. Tomorrow, it may be gone. It may return garbage every time it is called. It doesn't even have to be deterministic. Some functions can be created and don't have string representations (using Function::bind). It can only possibly work for pure functions. It's a bad idea all around.

@apaleslimghost

Copy link
Copy Markdown
Contributor

@michaelficarra Harmony is going to standardise it.

@satyr

satyr commented Mar 21, 2013

Copy link
Copy Markdown
Contributor

http://wiki.ecmascript.org/doku.php?id=harmony:function_to_string

And SpiderMonkey now conforms to that. So barring old SpiderMonkey, Function::toString returning the source should be pretty reliable.

@vendethiel vendethiel mentioned this pull request Jun 6, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants