quasi-literal strawman

David-Sarah Hopwood david-sarah at jacaranda.org
Tue Dec 15 12:24:50 PST 2009


Mike Samuel wrote:
> 2009/12/15 Tom Van Cutsem <tomvc at google.com>:
>> 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).

-- 
David-Sarah Hopwood  ⚥  http://davidsarah.livejournal.com

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 292 bytes
Desc: OpenPGP digital signature
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20091215/3a00153e/attachment.bin>


More information about the es-discuss mailing list