On 07-May-2000, S.D.Mechveliani <[EMAIL PROTECTED]> wrote:
> Marcin 'Qrczak' Kowalczyk <[EMAIL PROTECTED]> writes
> 
> > Sample arguments are bad, because:
> > [5 points follow]
> 
> But they are only for snobs. 

That doesn't matter; we don't want to add a bad feature,
regardless of who is likely to use it.

> > 1. They present a confusing interface. This looks like a function,
> >   but the real meaning is a constant. Neither mathematics nor
> >   programming languages treat zero as a function from any unused
> >   number to the zero value.
> 
>   zero `asTypeOf` x    is also a function applied to  x.
>                        Where is the difference?

See my earlier mail: `asTypeOf' is essentially a language construct.

> > 5. They hurt performance, Not always they can be optimized out.
> 
> Why?  zero `asTypeOf` x   is as likely to be optimized as  zero x.

That is not true.  The reason is that `asTypeOf' is a (standard
Prelude) function, whereas `zero' is a class method.  Since `asTypeOf'
has a trivial definition, any half-decent optimizing compiler will
inline it.  Specializing class methods, on the other hand, is
more difficult.

> If for the former, the instance of `zero' is defined simply and can 
> be, say in-lined, then the latter can too.

That is pretty much true.  The problem comes when the compiler
*can't* figure out statically which instance of `zero' this
code will call.

> basAlgPropos  introduces `zero x' because
>   * Haskell has problems with constants in methods, in particular
>             `asTypeOf` is often needed,

I don't buy that argument.

>   * `zero x'  fits the aim of implicit dynamic domains.

This one is much more interesting.

-- 
Fergus Henderson <[EMAIL PROTECTED]>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger [EMAIL PROTECTED]        |     -- the last words of T. S. Garp.

Reply via email to