Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #30586

Re: not "autovivification", but ...?

From "Christoph M. Becker" <cmbecker69@arcor.de>
Newsgroups comp.lang.javascript
Subject Re: not "autovivification", but ...?
Date 2016-05-31 14:11 +0200
Organization solani.org
Message-ID <nijv1k$106$1@solani.org> (permalink)
References <autovivification-20160531121607@ram.dialup.fu-berlin.de> <strict-20160531125113@ram.dialup.fu-berlin.de>

Show all headers | View raw


On 31.05.2016 at 13:51, Stefan Ram wrote:

> ram@zedat.fu-berlin.de (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.

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.

-- 
Christoph M. Becker

Back to comp.lang.javascript | Previous | NextNext in thread | Find similar | Unroll thread


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