Bother!  Sent this only to Simon...
------ Forwarded message ------
    From: [EMAIL PROTECTED]
 Subject: Re: Int vs Integer
    Date: Tue, 15 Sep 1998 18:15:01 +0100 (BST)
      To: [EMAIL PROTECTED]

On 15 Sep, Simon Peyton-Jones wrote:
> I think there is one powerful argument for retaining the status quo,
> but it is one no one has commented on: overloaded types can give
> rise to strange error messages that bite beginners.

I think that is mainly a question of designing good error messages.
If there is only one alternative in scope, it should be possible to
give helpful hint, for example.  There is also nothing to stop a
teacher providing a library where things are specialised if this is
still a problem.  Phil's remarks are also to the point.

> After all, we have just *un-overloaded* map and friends for just
> this reason.

I think that was a mistake, given my above observations.

>       - generalise length, splitAt, drop, take, replicate
>       - generalise toEnum, fromEnum
>       - leave (!!) alone (arrays must fit in an address space)

True, but worry about the knock-on effect of using a variable in an
index to an array, causing other expressions to be typed at Int.
Overload that too!

Given that the report already mentions the 'specialize' pragma, I
don't see any reason why the newly overloaded functions shouldn't be
accompanied by specialisations for both Integer and Int, which should
remove the efficiency drawback of making this change.


  Jon

-- 
Jon Fairbairn                                 [EMAIL PROTECTED]






Reply via email to