List Info

Thread: Re: NATURAL_32 vrs. INTEGER_32




Re: NATURAL_32 vrs. INTEGER_32
country flaguser name
United States
2008-03-19 13:35:38

So, since you are not rewriting everything for me [smile], as I write
new classes is there a reason I should or should not use NATURALs
where in the past it would have been INTEGER?

--- In eiffel_software%40yahoogroups.com">eiffel_softwareyahoogroups.com, "Emmanuel Stapf [ES]"
<manus...> wrote:
&gt;
> > This also got me thinking about HASH_TABLE and
HASH_TABLE.hash_code.
> > Theorectically, could these be NATURALs instead of INTEGERs?
>
> Yes.
>;
> > What am I missing here? Is there a reason a new class should
> > not use NATURAL_xx in place of INTEGER for features such as
> > `count', `max_items', etc.?
&gt;
> Yes, if we were to rewrite everything from scratch, we would
definitely use
> NATURAL since they provide 2 major benefits:
> - no need for assertions of the type `x >= 0'
> - containers can now hold twice as much items as before (4G instead
of 2G).
>;
> Manu
>;

__._,_.___
.

__,_._,___
RE: Re: NATURAL_32 vrs. INTEGER_32
user name
2008-03-19 13:41:17

> So, since you are not rewriting everything for me [smile], as
> I write new classes is there a reason I should or should not
> use NATURALs where in the past it would have been INTEGER?

It depends on how much you use those NATURAL with existing containers. For
example to index arrays you still need to use INTEGER, so if you were to use
NATURAL, then you would have to convert all NATURAL into INTEGER. This may
make your code heavier. So it is really up to you to decide what is best.

Manu

__._,_.___
.

__,_._,___
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )