three small proposals: the bikeshed cometh!

Brendan Eich brendan at mozilla.com
Thu Apr 29 17:04:40 PDT 2010


On Apr 29, 2010, at 4:39 PM, Mike Samuel wrote:

> 2010/4/29 Mark S. Miller <erights at google.com>:
>> On Thu, Apr 29, 2010 at 2:40 PM, Brendan Eich <brendan at mozilla.com>  
>> wrote:
>>>
>>> The JSConf audience poll did provoke someone to suggest "fun", and I
>>> mentioned "fn" (the ML family languages have both). Two letters or  
>>> three
>>> might be few enough, and avoid the line-noise and can't-type-Greek  
>>> issues.
>>
>> Neither "fun" nor "fn" are reserved identifiers. They are short ascii
>> identifiers, so conflicts are virtually guaranteed. I don't see any
>> realistic way to make them keywords without either breaking the web  
>> or (in
>> your terminology) raising the opt-in migration tax too high. Am I  
>> missing
>> something? If there is a painless way to introduce short keywords  
>> that
>> weren't previously reserved, I'd love to understand that.
>
> http://www.google.com/codesearch?q=file:\.js$+\bfun\b
> http://www.google.com/codesearch?q=file:\.js$+\bfn\b
>
> fun is used as an identifier in dojo in the first hit, and fn is used
> as an identifier in jquery in the first hit.

Yeah; the .fn (fn as qualified property name) uses are ok, of course.  
ES5 unreserves keywords in property name contexts (after. and before :  
in an object initialiser).

Without getting all PL/I here, we're probably out of luck on fn and  
fun. The temptation is to allow expressions other than at the start of  
statements to begin with these, provided they are followed by an  
identifier or a ( -- but in the latter case we would have to rule out  
a function denoted fn being called. This is the road to hell.

At JSConf I said in reply to the person who suggested "fun" that it's  
hard to reserve new identifiers. But we're trying with let and yield,  
not to mention const (not reserved by IE, AFAIK). Some browsers  
reserve const already, so perhaps that helps. No one reserves fun or  
fn, and your codesearch shows people colonizing those two fine plots  
in the space of all names.

So, back to the funny letters and #. ;-)

/be



More information about the es-discuss mailing list