ECMAScript-regrets icon indicating copy to clipboard operation
ECMAScript-regrets copied to clipboard

direct property access on integers

Open michaelficarra opened this issue 13 years ago • 3 comments

I know that one was certainly a regret.

michaelficarra avatar Jul 17 '12 20:07 michaelficarra

I've got some time to write a bit more for that project, so I'm going over the issues. What did you mean here? Are you saying that implicit string coercion of integers in o[12] are to be regretted? Or that integers (and other types) should have their own storage, not just strings? or something else?

DavidBruant avatar Oct 16 '12 07:10 DavidBruant

You can't directly access a member of an integer (no decimal point in the number). You can access a member of 1. with 1..member and access a member of (1) with (1).member, but you can't simply access a member of 1 with 1.member because the . is assumed to be part of the number. Basically, the problem is derived from allowing trailing decimal points in number literals. That was a horrible idea both because of this issue and because leading and trailing decimal points are bad style anyway.

michaelficarra avatar Oct 16 '12 12:10 michaelficarra

So true. Writing about it asap

DavidBruant avatar Oct 16 '12 12:10 DavidBruant