Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] Re: Updates to hof script

From: jan:skibinski:sympatico:ca at: 16-Nov-2002 13:15

Hi Dick, [reffy--ulrich--net] wrote:
> Hi Jan, > > In my language, if adding two integers overflows, then I automatically coerce the result to a higher type.
So do Smalltalk and Rebol. But all static languages I know of would fail here. Sometimes in quite a bad way - instead of crashing they would continue with wrong values. For example, Eiffel relies on a C compiler in its compile mode (It has also its native interpretive mode, useful during development - Melting Ice Technology, as they advertise it). Anyway when C register overflows it returns 0 - or at least that was a case with GNU compiler many years ago. No access to flags, so this is what you get.and Eiffel would inherit this problem. So much for safety and strong typing. See description of example of failure of Ariadne rocket, as popularized by Meyer. But that does not mean that Rebol would not fail because it does a silent coercion to decimals. It will fail at 2 ** 1024. That's astronomical number and why one would want to go that far? Well the example of the Ackerman function demonstrates how easy it is to get there. From the coercive perspective Smalltalk behaves better than Rebol because it switches from SmallInteger to LargePositiveInteger or LargeNegativeInteger, internally represented as sequences of bytes. Bypassing the float - unless you want to cast the numbers to float. Sky is you limit here, or rather the amount of memory Smalltalk is entitled to use for storing those huge numbers. And you must be of course aware of the fact that the bigger the float gets, the poorer resolution it has - there are tremendous holes between two closest float numbers. It's all about logarithmic scales. Some people still do not get it and try to use floats for computing with money.Think about all those missing chunks. Thinking about it now I have to examine the Rebol decimal! and money! a bit closer. I was assuming floats, but that cannot be the case in view of the above. Jan
> My question is more in line with liking your ideas, but wondering how one would include such > possibilities in your notation.
None that I know of. You can always declare and force using