Path: csiph.com!1.us.feeder.erje.net!feeder.erje.net!1.eu.feeder.erje.net!weretis.net!feeder4.news.weretis.net!feeder1.news.weretis.net!news.solani.org!.POSTED!not-for-mail From: "Christoph M. Becker" Newsgroups: comp.lang.javascript Subject: Re: not "autovivification", but ...? Date: Tue, 31 May 2016 14:11:32 +0200 Organization: solani.org Lines: 25 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: solani.org 1464696692 1030 eJwFwQcBADAIAzBNnHLsrIB/CUtgIcH0QDgO94oDFTN3KfpJd+G2cthTvTXjSq5m2j2ZDxdWEVE= (31 May 2016 12:11:32 GMT) X-Complaints-To: abuse@news.solani.org NNTP-Posting-Date: Tue, 31 May 2016 12:11:32 +0000 (UTC) User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0 X-User-ID: eJwNycEVAEEEBNGUeENb4Vim8w9h1PGXHyg6DA5zOn/2UWyiEnnzk0kPG7XBQjVlf47oLVbwAQZ1EKk= In-Reply-To: Cancel-Lock: sha1:IpDSCrf4ffEns4/Pa5/x2/hTFuQ= X-NNTP-Posting-Host: eJwFwQkBwDAIA0BLvIHIWVnxL6F36VBMBRKRmysy/1d6rMC+Y5HQ40K5JcQu6RWSNOtuch4GDA/P Xref: csiph.com comp.lang.javascript:30586 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