[bitc-dev] Types that introduce new literals
johnzabroski at gmail.com
Fri Nov 12 11:20:23 PST 2010
On Fri, Nov 12, 2010 at 2:15 PM, John Zabroski <johnzabroski at gmail.com>wrote:
> On Thu, Nov 11, 2010 at 7:44 PM, Jonathan S. Shapiro <shap at eros-os.org>wrote:
>> Other than bit sets and enumerations, what **commonly used** types want to
>> introduce new, named literals?
>> [and unions, for constructors]
> If you are asking about programming languages in general, then "syntax for
> hashes" has to be up there. Common Lisp has keyword lists, and Ruby has
> keyword identifiers that as I recall were borrowed from that language.
> When programmers don't have syntax for hashes, I've seen them do dumb
> things to abuse the production rules and semantics of the language. For
> example, the ASP.NET MVC team at Microsoft did the extremely foul sin of
> abusing new language features like anonymous classes to approximate Ruby's
> keyword identifiers and how Ruby on Rails makes use of them. There are
> other examples I can think of, but this one is fairly prominent and
> amusing. As a consequence of this stupid hijacking of language constructs,
> most of the APIs in the ASP.NET MVC trunk are not readable (in my humble
> opinion) because they contain gratuitous overloads to handle situations
> where the programmer passes in any old Object type, and the MVC runtime then
> uses .NET reflection to treat attribute names as keyword identifiers, and
> the attribute values as the coinciding mapped value.
> This is obviously really gross to any mathematician, and I would argue
> demonstrates that a language designer needs to know a lot about its users to
> design a good syntax for them.
Let me rephrase this to answer more directly:
Dictionary types "want"  to introduce new, named literals. Programmers
commonly call these literals "syntax for hashes".
 Well, I have never met a type that "wanted" to do anything for me.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the bitc-dev