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

Re: Fun-O Basic Edition Compiler



I realize that the following logical fallacy is so widespread that it
gets its own name -- "appealing to an authority" -- but here goes.

No less a language designer than Guy Steele, when asked what
he thinks should be in all modern languages, one of the five or so
things he mentioned was that there's "no excuse" (his words) for
any modern language not to transparently handle overflows from
small to large integers.

The devil's in the details, though.  I think that to get this right, the
programmer should use the "bignum" library and be rewarded with
this transparency.  If you don't use bignums, then all overflows should
be detected and an error should be signalled.  For operations that
wrap, you should be required to use a different operator; ordinary
operators like +, -, and * should always be "conservative".

"Jeffrey Siegal" <jbs@quiotix.com> wrote in message
3C321156.1020709@quiotix.com">news:3C321156.1020709@quiotix.com...
> Jason Trenouth wrote:
>
> > ----- Original Message -----
> > From: Jeffrey Siegal <jbs@quiotix.com>
> > To: <info-dylan@ai.mit.edu>
> > Sent: Thursday, December 27, 2001 5:15 AM
> > Subject: Re: Fun-O Basic Edition Compiler
> >
> >
> >
> >>Bruce Hoult wrote:
> >>
> >>>One niceish thing about Dylan is that if you decide that you'd like
> >>>*all* integers in the program to overflow to bignums instead of
wrapping
> >>>then all you have to do is rename <general-integer> to <integer> in the
> >>>imports section.
> >>>
> >>Actually, what I prefer is the behavior that is documented, but not
> >>implemented, in Stalin, which is for fixints to trap if they overflow.
> >>Transparently overflowing to bignums may hide a program bug or a hidden
> >>assumption that has been broken.
> >>
> >
> > Actually, not transparently overflowing to bignums usually causes more
> > problems by exposing hidden assumptions...
>
> I'm afraid I disagree.  If the programmer does not expect a number to
> get large, and it does, something has usually gone wrong.