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


Groups > comp.lang.javascript > #9250

Re: JavaScript: Trouble with switch Syntax

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!fu-berlin.de!uni-berlin.de!not-for-mail
From Jake Jarvis <pig_in_shoes@yahoo.com>
Newsgroups comp.lang.javascript
Subject Re: JavaScript: Trouble with switch Syntax
Date Thu, 15 Dec 2011 01:06:10 +0100
Lines 52
Message-ID <9ksrviFfhrU1@mid.uni-berlin.de> (permalink)
References <ug4ie75gitc6gc9rsse94i0slcpumt1pg0@4ax.com> <jcb9ni$s8l$1@speranza.aioe.org> <9ksqilF6afU1@mid.uni-berlin.de>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding 7bit
X-Trace news.uni-berlin.de UUCgO5jcMEefyrjnVrs6FQ3NBA7SXqQrm2YyouONH7RDtRv9E=
User-Agent Mozilla/5.0 (Windows NT 5.1; rv:8.0) Gecko/20111105 Thunderbird/8.0
In-Reply-To <9ksqilF6afU1@mid.uni-berlin.de>
Xref x330-a1.tempe.blueboxinc.net comp.lang.javascript:9250

Show key headers only | View raw


On 15.12.2011 00:42, Jake Jarvis wrote:
> On 14.12.2011 23:58, Aaron Sawyer wrote:
>> "Gene Wirchenko"<genew@ocis.net> wrote in message
>> news:ug4ie75gitc6gc9rsse94i0slcpumt1pg0@4ax.com...
>>> Dear JavaScripters:
>>>
>>> I have hanged myself yet again with syntax.
>>>
>>> Did you know that -- in IE9, at least -- you can use
>>> otherwise
>>> instead of
>>> default:
>>> in a switch statement?
>>>
>>> Yes, you can. It does not throw an error, but it also does not
>>> do anything. Unless you count time wasted looking for a bug.
>>>
>>> I may as well ask if anyone else has committed such bogosities.
>>>
>> Not that particular one, but plenty of others.
>>
>> 'otherwise' (without the quotes) on a line by itself, presumably
>> following a
>> 'break;'will trigger Javascript/JScript/ECMAscript's default behaviors:

    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Sorry, concentrated on just a part of the quote.

Following a 'break' in a case's statement list, the 'otherwise' 
identifier will not be acted upon at all during evaluation.

>> (1) 'otherwise' is not a reserved word, therefore it is an identifier;
>> (2) the identifier 'otherwise' is not declared locally (in a 'var'
>> statement), therefore it must be a property attached to the global object
>> (and created there if not found);
>
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> That is not right in this case of "reading" (identifier 'otherwise'
> alone in expression or statement), if not found, an error must occur
> (see the abstract GetValue operation in the specifications).
>
>> (3) end of line has been encountered, therefore a semicolon must have
>> been
>> intended (!) and will be supplied by the language processor.
> <snip>
>
<snip>

-- 
Jake Jarvis

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


Thread

JavaScript: Trouble with switch Syntax Gene Wirchenko <genew@ocis.net> - 2011-12-14 13:23 -0800
  Re: JavaScript: Trouble with switch Syntax Jake Jarvis <pig_in_shoes@yahoo.com> - 2011-12-14 23:32 +0100
    Re: JavaScript: Trouble with switch Syntax Tim Streater <timstreater@greenbee.net> - 2011-12-14 22:39 +0000
    Re: JavaScript: Trouble with switch Syntax Gene Wirchenko <genew@ocis.net> - 2011-12-14 18:11 -0800
      Re: JavaScript: Trouble with switch Syntax Dr J R Stockton <reply1150@merlyn.demon.co.uk> - 2011-12-16 21:28 +0000
  Re: JavaScript: Trouble with switch Syntax "Aaron Sawyer" <aaron.sawyer@deltaware.com> - 2011-12-14 18:58 -0400
    Re: JavaScript: Trouble with switch Syntax Jake Jarvis <pig_in_shoes@yahoo.com> - 2011-12-15 00:42 +0100
      Re: JavaScript: Trouble with switch Syntax Jake Jarvis <pig_in_shoes@yahoo.com> - 2011-12-15 01:06 +0100
    Re: JavaScript: Trouble with switch Syntax Gene Wirchenko <genew@ocis.net> - 2011-12-14 18:09 -0800
      Re: JavaScript: Trouble with switch Syntax Ross McKay <au.org.zeta.at.rosko@invalid.invalid> - 2011-12-15 18:33 +1100

csiph-web