Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #32025
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!2.eu.feeder.erje.net!feeder.erje.net!1.eu.feeder.erje.net!weretis.net!feeder4.news.weretis.net!feeder5.news.weretis.net!news.solani.org!.POSTED!not-for-mail |
|---|---|
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
| Newsgroups | comp.lang.javascript |
| Subject | Re: What I learned today |
| Date | Thu, 29 Dec 2016 19:48:31 +0100 |
| Organization | PointedEars Software (PES) |
| Lines | 153 |
| Message-ID | <7272888.NyiUUSuA9g@PointedEars.de> (permalink) |
| References | <JavaScript-20161229003655@ram.dialup.fu-berlin.de> <assignment-and-references-in-ECMAScript-20161229185228@ram.dialup.fu-berlin.de> |
| Reply-To | Thomas 'PointedEars' Lahn <usenet@PointedEars.de> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset="UTF-8" |
| Content-Transfer-Encoding | 8Bit |
| X-Trace | solani.org 1483037368 14193 eJwFwQkRwEAIBDBL7AHLIIfy+JfQxJVgh9Fpfn42sJwUjCHe2d1I9adFCeDp6nXoRtVSF/kDGGMRIw== (29 Dec 2016 18:49:28 GMT) |
| X-Complaints-To | abuse@news.solani.org |
| NNTP-Posting-Date | Thu, 29 Dec 2016 18:49:28 +0000 (UTC) |
| User-Agent | KNode/4.14.2 |
| X-NNTP-Posting-Host | eJwNysERwDAIA7CV6IFNGIe4sP8Ird6C86EyCAYWK/mKRxNzk8ZKG+Mt1OulsDzR25bT/yHiAyb7EUc= |
| X-Face | %i>XG-yXR'\"2P/C_aO%~;2o~?g0pPKmbOw^=NT`tprDEf++D.m7"}HW6.#=U:?2GGctkL,f89@H46O$ASoW&?s}.k+&.<b';Md8`dH6iqhT)6C^.Px|[=M@7=Ik[_w<%n1Up"LPQNu2m8|L!/3iby{-]A+#YE}Kl{Cw$\U!kD%K}\2jz"QQP6Uqr],./"?;=4v |
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4bsDA+egAAAABJRU5ErkJggg== |
| Xref | csiph.com comp.lang.javascript:32025 |
Show key headers only | View raw
Stefan Ram wrote:
> ram@zedat.fu-berlin.de (Stefan Ram) writes:
>>- The "references" are in ECMAscript to describe what is
>>happening when functions return values that can be
>>assigned to ("references"), but this only is intended
>>for host objects. Otherwise, JavaScript can be described
>>with the concept of bindings (to names) alone.
>
> The Assignement In ECMAScript
> (based loosely on ECMA-262 as of June 2016)
That is, <http://www.ecma-international.org/ecma-262/7.0/>.
> Here, I will now give a /simplified/ description of
> what
… *you* think …
> is happening in ECMAScript when one fires up his
> browser and enters
>
> a = 2
>
> into the JavaScript console.
>
> […]
> 8.3.2 »ResolveBinding( name )«
>
> (This is still about getting the reference to the left side.)
>
> »ResolveBinding« essentially calls »GetIdentifierReference( glob,
> name )«. »glob« in this case is the global lexical environment,
> which has been initialized at the start of script execution
> according to 15.1.10, step 1 and 7 to be the global environment.
>
> 8.2.1. »GetIdentifierReference( glob, name )«
>
> (This is still about getting the reference to the left side.)
>
> »GetIdentifierReference( glob, name )« essentially returns the
> reference »[ glob, name ]« (according to step 4.a).
>
> 12.15.4 »=« The Assignment
>
> Now, that we have gotten the reference »[ glob, name ]« to
> the left side, the assignment essentially calls
> »PutValue( [ glob, name ], newValue )«.
>
> 6.2.3.2 »PutValue( [ glob, name ], newValue )«
>
> This value put operation essentially calls
> »glob.[[Set]]( [ glob, name ], newValue, glob )«.
You have omitted important aspects.
| 6.2.3.2 PutValue (V, W)
|
| […]
| 3. If Type(V) is not Reference, throw a ReferenceError exception.
| 4. Let base be GetBase(V).
| 5. If IsUnresolvableReference(V) is true, then
| a. If IsStrictReference(V) is true, then
| Throw a ReferenceError exception.
This means that if you have declared strict mode and there is no object in
the scope chain that has a property whose name corresponds with the
identifier, and there is also no variable who does, a ReferenceError
exception is thrown.
| b. Let globalObj be GetGlobalObject().
| c. Return ? Set(globalObj, GetReferencedName(V), W, false).
[sic]
This means that if you have not declared strict mode, and there is no such
property name or variable identifier, the global object will be augmented
with a property that has the identifier as its name.
| 6. Else if IsPropertyReference(V) is true, then
But if the identifier can be resolved instead, …
| a. If HasPrimitiveBase(V) is true, then
and the base value is a primitive value, …
| i. Assert: In this case, base will never be null or undefined.
| ii. Set base to ToObject(base).$
… then convert that value to an object …
| b. Let succeeded be
| ? base.[[Set]](GetReferencedName(V), W, GetThisValue(V)).
… for the purpose of property write access.
| c. If succeeded is false and IsStrictReference(V) is true, throw a
| TypeError exception.
If the property could not be written to, throw an exception.
| d. Return.
Otherwise return successfully. (AISB. This is why it is error-prone to use
identifiers without declaration as if they were variables.)
> 9.1.9 »glob.[[Set]]( [ glob, name ], newValue, glob )«
You have misquoted the specification and added your own misconceptions.
The actual text is
| 9.1.9 [[Set]] ( P, V, Receiver)
indicating that it is not necessarily the global object whose property is
being written to here.
Also, there is not only one internal [[Set]] method; it depends on the
object who has the property which [[Set]] method is invoked, and it depends
on the property. For example:
| Table 3: Attributes of an Accessor Property
|
| Attribute Name Value Domain Description
| […]
| [[Set]] Object | Undefined If the value is an Object it must be a
| function object. The function's
| [[Call]] internal method (Table 6) is
| called with an arguments list
| containing the assigned value as its
| sole argument each time a set access
| of the property is performed. The
| effect of a property's [[Set]]
| internal method may, but is not
| required to, have an effect on the
| value returned by subsequent calls to
| the property's [[Get]] internal
| method.
> This non-static method essentially calls the static
> helper method 9.1.9.1
> »OrdinarySet( glob, [ glob, name ], newValue, glob )«.
>
> […]
Ex falso quodlibet.
--
PointedEars
FAQ: <http://PointedEars.de/faq> | <http://PointedEars.de/es-matrix>
<https://github.com/PointedEars> | <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | Please do not cc me./Bitte keine Kopien per E-Mail
Back to comp.lang.javascript | Previous | Next | Find similar | Unroll thread
Re: What I learned today Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-12-29 19:48 +0100
csiph-web