On Tue, Jan 29, 2013 at 01:44:20AM +0100, bearophile wrote: > Walter Bright: > > >http://www.drdobbs.com/cpp/implementing-half-floats-in-d/240146674 > > From the article: > > >Built-in types tend to run faster because the optimizer can take > >advantage of mathematical identities,< > > Generally in D we like the compiler to verify user-applied > annotations like pure and const. For the compiler of a normal > language today it's probably too much difficult to prove the > theorems coming from those identities on user defined types. But if > the compiler assumes the programmer to be right on this (because > such types are usually defined in well reviewed libraries), then I > think it's not too much hard to invent a small set of @annotations > that attached to a user defined struct tell the compiler to allow > some optimizations typical of integral numbers, floating point > numbers, complex numbers, gaussian integers, quaternions, octonions > and few others, according to them having associative, commutative, > etc, properties, or not having them. [...]
+1. I've always wanted a language capable of user-specified optimizations for custom types. This would be very useful on things like matrix types, which would otherwise require heavy trickery with expression templates in order to produce efficient code. T -- May you live all the days of your life. -- Jonathan Swift
