[Aldor-l] [fricas-devel] Re: "has" in the interpreter
Bill Page
bill.page at newsynthesis.org
Wed Nov 19 14:02:45 EST 2008
On Wed, Nov 19, 2008 at 12:31 PM, Ralf Hemmecke wrote:
> ...
> But it shows that 'is'/'has' might lead to lots of branches and thus
> the code doesn't scale very well.
>
> But look at
>
> mygcd(R: EuclideanDomain)(a: R, b: R): R == {
> R has Field => if zero? a and zero? b then 0 else 1;
> while not zero? b repeat { (a, b) := (b, a rem b) }
> return a;
> }
>
> That I consider a case where 'has' is useful.
>
I agree. I am not arguing against such usage. It seems to me that when
'has' refers to a category this tells us a lot about the user's
intentions (i.e. it is good documentation) and because categories are
(usually) rather large things, it is unlikely that we will see a lot
of branching code.
'is' however is something else. It invites the programmer to deal with
specific cases rather than the most general case.
> ...
Regards,
Bill Page.
More information about the Aldor-l
mailing list