[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Vectors as functions



On Monday, Aug 18, 2003, at 13:52 US/Eastern, mike@newhall.net wrote:

>> Sometimes it can be hard to allow the language user the choice.
>> Suppose I had a language that allowed you to override the primitive
>> arithemetic via an `*arithmetic-operation-hook*'...so chances are this
>> language would be dog-slow in math....   even if you *didn't* ever
>> use this hook.
>
>     I understand that offering that kind of freedom *at all times* 
> would
> break optimization at all times.  What I mean is, what if you could
> say something like "I don't need to use the
> *arithmetic-operation-hook* in this project / module / procedure /
> expression", so that the one-to-one mapping with machine operations
> was restored locally or globally, and the compiler could apply all the
> traditional optimizations.

This is exactly what the Dylan 'sealed' declaration is for: it declares 
a subdomain of a generic function as not requiring extensibility beyond 
the module (compilation unit) in which it is defined, thus enabling 
optimization.

Actually, Dylan defaults to generic function domains being sealed -- 
you declare as 'open' the domains where you require (or want to 
provide) extensibility, and you understand that by making that 
declaration, you will pay the price.

C++'s 'final' declaration is much more simplistic, in that it is 
sealing on one axis only, and it prohibits extension anywhere.