2009/12/15 David-Sarah Hopwood <[email protected]>: > Mike Samuel wrote: >> 2009/12/15 Tom Van Cutsem <[email protected]>: >>> Hi, >>> >>> Could you motivate why you chose to append the string "Quasi" to the type >>> tag identifier? [...] >>> I know E employs a similar mechanism, but I don't know if it's worth having >>> it for Javascript. >>> Essentially, this is a form of name-mangling, which is fine if you're doing >>> macros/translation/compilation where the programmer is shielded from the >>> mangled name, but is weird when the programmer has to work with both mangled >>> and non-mangled names. If the type tag Identifier is going to be resolved >>> lexically anyway, and not in some separate namespace, wouldn't it be simpler >>> if one could write: >>> >>> var html = ...; >>> ... >>> html`...` >> >>> It is immediately apparent, even to someone not familiar with the language >>> feature's details, that 'html' will somehow refer to the quasi-function > > I'm with Tom on this. I've always thought E's mangling of the tag is ugly. > (Note that one possible reason for doing that in E -- the fact that there > are other namespaces that work in a similar way such as *__uriGetter -- > does not apply to ECMAScript.) > >> I'm not sure that it's obvious that there would be a linkage between a >> type tag and a function of the same name, but I am worried about >> posible collisions due to the dearth of short type-descriptive names >> available for use as local variable names. Consider: var html = >> html`...`; > > One possibility is to make the tags uppercase by convention: > > HTML`...`; > XML`...`; > SQL`...`; > > Since language names are very often acronyms, this looks perfectly > natural (and I think it looks fine even when the name is not an acronym).
The UCASE_UNDERSCORED namespace is often used for things that are supposed to be constant in keeping with java style ( http://java.sun.com/docs/codeconv/html/CodeConventions.doc8.html#367 ), so unlikely to be used for locals and formals. > -- > David-Sarah Hopwood ⚥ http://davidsarah.livejournal.com > > > _______________________________________________ > es-discuss mailing list > [email protected] > https://mail.mozilla.org/listinfo/es-discuss > > _______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

