No code block without introductory keyword (was: Re: Boolean shortcuts)

Herby Vojčík herby at
Wed Jan 4 06:18:34 PST 2012


I am sorry that I am so dense in my communication, I meant not only "no code 
block without formal introduction", but also adding a keyword to the 
repertoire that, in those rare cases of free code block (they are not really 
that common), introduces a free code block. The rule of NCBWFI makes the 
code really formally clearer. You see in François's example that the change 
is not big (I would personally like "local" more than "eval", somehow the 
old associations from the university sprung up from SML/NJ course where 
local and let were coupled, so it seemed like good choice, but "local" 
cannot be a keyword since it is surely used in _lots_ of places as a 
variable name).


-----Pôvodná správa----- 
From: Maël Nison
Sent: Wednesday, January 04, 2012 2:56 PM
To: Herby Vojčík
Cc: François REMY ; es-discuss at
Subject: Re: No code block without introductory keyword (was: Re: Boolean 

If we force a formal block introduction, there will be some problems
with codes like this one :

var foo = function ( ) {
        let x = 42;
        console.log( x );
        let x = 24;
        console.log( x );

On 4 January 2012 14:51, Herby Vojčík <herby at> wrote:
> Hi,
> what you proposed seems like a pretty good idea (at least imho).
> All other uses of {...} as code block have a introductory keyword / 
> control
> structure (if, else, while, do, function), and even the newcomer {...} 
> uses
> like module and class are preceded by one. If (maybe in "strict ES6+" 
> only)
> there was the general rule of "no code block without formal introduction",
> it could make parsing much more quirk-free (and it would be clearly define
> that {...} without introduction is _always_ object literal (or, more
> broadly, data-producing {...} (declarative curlie)) in contrast to
> imperative curlie that contains some form of action to perform).
> Herby
> -----Pôvodná správa----- From: François REMY
> Sent: Wednesday, January 04, 2012 2:27 PM
> To: Herby Vojčík ; es-discuss at
> Subject: Re: Boolean shortcuts
> I agree that code block is a complex feature that is (almost) never used 
> and
> that has many quirks.
> If ES6 could remove it, I would not be upset at all. If it's here to stay,
> we should at least have an introductory keyword like "eval { ... }" and
> allow "var x = eval { ... }".
> BTW, I think the reason of your inconsistency is a bug : eval("{}") should
> return undefined, as in IE9. It seems that node.js has a special case for
> {}, probably to avoid a common mistake. Or there's a bug in the parser, I
> don't know.
> _______________________________________________
> es-discuss mailing list
> es-discuss at

Maël Nison
Epitech 2014, Paris - Astek 

More information about the es-discuss mailing list