Real world examples of Ecmascript functions returning a Reference?
Posted
by
Bergi
on Stack Overflow
See other posts from Stack Overflow
or by Bergi
Published on 2012-10-29T15:14:41Z
Indexed on
2012/10/30
17:01 UTC
Read the original article
Hit count: 205
JavaScript
|reference
Read the EcmaScript specification, section 8.7 The Reference Specification Type:
The
Reference
type is used to explain the behaviour of such operators asdelete
,typeof
, and the assignment operators. […] A Reference is a resolved name binding.Function calls are permitted to return references. This possibility is admitted purely for the sake of host objects. No built-in ECMAScript function defined by this specification returns a reference and there is no provision for a user-defined function to return a reference.
Those last two sentences impressed me. With this, you could do things like coolHostFn() = value
(valid syntax, btw). So my question is:
Are there any EcmaScript implementations that define host function objects which result in Reference
values?
© Stack Overflow or respective owner