Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #30593
| X-Received | by 10.140.238.16 with SMTP id j16mr12823557qhc.27.1464792661125; Wed, 01 Jun 2016 07:51:01 -0700 (PDT) |
|---|---|
| X-Received | by 10.157.8.248 with SMTP id 111mr66990otf.16.1464792661080; Wed, 01 Jun 2016 07:51:01 -0700 (PDT) |
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!peer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!p34no1258439qgp.1!news-out.google.com!g40ni288qge.1!nntp.google.com!q32no2277522qgq.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail |
| Newsgroups | comp.lang.javascript |
| Date | Wed, 1 Jun 2016 07:51:00 -0700 (PDT) |
| In-Reply-To | <nijv1k$106$1@solani.org> |
| Complaints-To | groups-abuse@google.com |
| Injection-Info | glegroupsg2000goo.googlegroups.com; posting-host=24.106.62.102; posting-account=hYRygAoAAABkmvJVmPilz9Q1TOjgPQAq |
| NNTP-Posting-Host | 24.106.62.102 |
| References | <autovivification-20160531121607@ram.dialup.fu-berlin.de> <strict-20160531125113@ram.dialup.fu-berlin.de> <nijv1k$106$1@solani.org> |
| User-Agent | G2/1.0 |
| MIME-Version | 1.0 |
| Message-ID | <73cd9155-4dba-40be-8cd8-2a18726969bd@googlegroups.com> (permalink) |
| Subject | Re: not "autovivification", but ...? |
| From | "Michael Haufe (TNO)" <tno@thenewobjective.com> |
| Injection-Date | Wed, 01 Jun 2016 14:51:01 +0000 |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | quoted-printable |
| X-Received-Bytes | 2527 |
| X-Received-Body-CRC | 1513826707 |
| Xref | csiph.com comp.lang.javascript:30593 |
Show key headers only | View raw
On Tuesday, May 31, 2016 at 7:11:39 AM UTC-5, Christoph M. Becker wrote:
> On 31.05.2016 at 13:51, Stefan Ram wrote:
>
> > (Stefan Ram) writes:
> >> "use strict"; this.b = 1;
> >
> > And I wonder, why in strict mode in the outmost scope, when
> >
> > b = 1
> >
> > is forbidden (given that »this.b« does not exist)
> >
> > this.b = 1
> >
> > is allowed. What is the rationale for allowing it with »this.«?
>
> `this` is not special in this regard; you can assign to undefined
> properties of *any* object.
Most, not any. For example: [1]
> Also consider that accessing undefined properties of an object yield
> `undefined` (but not an error), so it appears to be logical to allow
> assigning another value to such undefined properties.
That does not follow. Ex:
//assume this function is defined in a 3rd party library
function getSomeObject(){
return Object.seal({
hello: "world"
})
}
//in your code somewhere:
var someObject = getSomeObject()
typeof someObject.hello // string
typeof someObject.hola // undefined
someObject.hola = "mundo"
typeof someObject.hola // undefined
[1] <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/seal>
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: not "autovivification", but ...? "Christoph M. Becker" <cmbecker69@arcor.de> - 2016-05-31 14:11 +0200
Re: not "autovivification", but ...? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-06-01 07:51 -0700
Re: not "autovivification", but ...? "Christoph M. Becker" <cmbecker69@arcor.de> - 2016-06-01 18:46 +0200
csiph-web