Prev: Are arguments that are objects passed by reference?
Next: FAQ Topic - How do I access a frame's content? (2009-10-25)
From: VK on 29 Oct 2009 12:39 VK <schools_r...(a)yahoo.com> writes: > >> That's pretty much points to your regular problem when dealing with > >> JavaScript, and on a bigger scale - the common problem of many > >> regulars, getting the base of their wisdom from ECMA262 3rd.ed. > >> ECMA262 3rd.ed. is an extremely bad source to learn the language Lasse Reichstein Nielsen wrote: > > Agree. Thomas 'PointedEars' Lahn wrote: > IBTD! It is a unmoderated newsgroup, so don't worry http://www.urbandictionary.com/define.php?term=ibtd
From: John G Harris on 29 Oct 2009 16:40 On Thu, 29 Oct 2009 at 09:36:40, in comp.lang.javascript, VK wrote: <snip> >The purpose of an identifier is to name something, <snip> Very true, and in this case it names a property. However, the language's syntax rules give you three ways to name a property in an object literal, viz : as an Identifier as a StringLiteral as a NumericLiteral and it's the job of the parser to cope with all three possibilities and extract the appropriate property name and deliver it to the next stage of compilation. In that next stage you might want to call it an "identifier", but try not to get confused between the syntax rules that programmers have to know about and the internal workings of the compiler, which they don't. John -- John Harris
From: VK on 31 Oct 2009 13:52 > <snip>>The purpose of an identifier is to name something, > > <snip> > > Very true, and in this case it names a property. Well, it was already suggested as a joke in my post at http://groups.google.com/group/comp.lang.javascript/msg/add1efacca25c5b2 "I even can imagine that such "non-identifying identifier" still identifies something: namely string literal value foo (charcode sequence \u0066\u006F\u006F), in a round around way like identifier true identifies boolean value true". If you - or anyone else - liked the joke so much that decided to use it seriously then of course it's your decision: just don't get upset if others will keep considering it as a joke. Also for the appropriate transformation of a joke into a serious theory some extra job should be suggested. In the particular IMHO it is necessary to introduce a class of "bivalent number literal identifiers" (BiNuLid) that either used to express numbers or used to identify object property names. In the last case the identified property name is not directly connected with the BiNulid's literal form. A few examples of BiNuLids: 300000000000000000003 identifies property name "30000000000000000000" 3000000000000000000003 identifies property name "3e+21" Overall as I said in the linked post, having enough of beer, spare time and absolutely nothing better to do, the theory can be brought to a profoundly perfect dogmatic form (yet remain utterly useless as such). > However, the language's syntax rules give you three ways to name a > property in an object literal, viz : > > as an Identifier > as a StringLiteral > as a NumericLiteral No, the language gives you only one option to name a property in an object literal, this is a string literal. The language allows you to be lazy and skip on quotes, but you should be very careful with it because unlike in other languages with such convenience shortcut, JavaScript parser doesn't have extra logic added to handle it properly. ....
From: John G Harris on 31 Oct 2009 17:04 On Sat, 31 Oct 2009 at 10:52:22, in comp.lang.javascript, VK wrote: <snip nonsense> >> However, the language's syntax rules give you three ways to name a >> property in an object literal, viz : >> >> �as an Identifier >> �as a �StringLiteral >> �as a �NumericLiteral > >No, the language gives you only one option to name a property in an >object literal, this is a string literal. The language allows you to >be lazy and skip on quotes, but you should be very careful with it >because unlike in other languages with such convenience shortcut, >JavaScript parser doesn't have extra logic added to handle it >properly. The programmer who codes the parser has a function to handle an Identifier, a function to handle a StringLiteral, and a function to handle a NumericLiteral all to hand and tested in many releases. But, you say, he doesn't use them for object literals because he wants to write the code all over again to do the same job. He ought to be sacked for doing that. KEEP IT SIMPLE! John -- John Harris
From: Lasse Reichstein Nielsen on 31 Oct 2009 18:15
VK <schools_ring(a)yahoo.com> writes: >> However, the language's syntax rules give you three ways to name a >> property in an object literal, viz : >> >> �as an Identifier >> �as a �StringLiteral >> �as a �NumericLiteral > > No, the language gives you only one option to name a property in an > object literal, this is a string literal. No! It is a string *value*! There are three ways to specify that string value: Identifier, string literal and number literal. Please distinguish literals (syntax) from values (semantics)! /L -- Lasse Reichstein Holst Nielsen 'Javascript frameworks is a disruptive technology' |