On Fri, Nov 12, 2010 at 2:15 PM, John Zabroski <[email protected]>wrote:
> > > On Thu, Nov 11, 2010 at 7:44 PM, Jonathan S. Shapiro <[email protected]>wrote: > >> Other than bit sets and enumerations, what **commonly used** types want to >> introduce new, named literals? >> >> [and unions, for constructors] >> >> shap >> >> > 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. > > Cheers, > Z-Bo > > Let me rephrase this to answer more directly: Dictionary types "want" [1] to introduce new, named literals. Programmers commonly call these literals "syntax for hashes". Cheers, Z-Bo [1] Well, I have never met a type that "wanted" to do anything for me.
_______________________________________________ bitc-dev mailing list [email protected] http://www.coyotos.org/mailman/listinfo/bitc-dev
