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

Re: Vectors as functions



At 1:52 PM -0400 8/18/03, 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.

The problem is that many of the interesting things you'd want to 
allow are tied to the data, rather than to the lexical scope the data 
lives in. You can't lexically scope that sort of stuff (well, you 
can, but then you end up with data that behaves differently depending 
on where it's used, which is probably sub-optimal--you'd probably 
rather not want operator overloading to work only in some places) so 
you have to pay at least some cost everywhere to support it.

You can generally get away with major changes in available behavior 
if you cross over a significant boundary--usually changing languages 
is sufficient warning that the rules will change--but I'd expect that 
data-based behaviour changes on a smaller boundary would cause more 
confusion than you'd get back in benefit.
-- 
                                         Dan

--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
dan@sidhe.org                         have teddy bears and even
                                       teddy bears get drunk