Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

If I understand it right, you're suggesting limiting it to just an <identifier> ? I agree and if we would all standardise on just that it'd fine by me...

But, having said that, array_of_functions[index] is also a common pattern that i've personally had to resort to several times... and is also defined in the original JSON-P article... The code already supports nested object.property.property expressions and I'd welcome patches to support object['key'] -- which I've also used several times in the past.

And given the very little extra effort (less than 10 lines of code) required to support:

<identifier>.<identifier> <identifier>[<integer>]

I didn't see why/how it'd hurt to put that forward to standardise around... ?



Because it's (relatively) easy to validate (if you're going to) a simple identifier (ignoring UTF-8 issues and that $ can be in an identifer, I'd almost consider it matching ^\w+$ to be enough), and it's increasingly harder to properly validate javascript expressions without actually having a javascript interpreter and parsing/executing it. More complexity means an incrase in the possibility of bugs and more divergent implementations.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: