[m-rev.] for review: deconstruct by functor number
Ralph Becket
rafe at csse.unimelb.edu.au
Wed Jan 3 09:35:53 AEDT 2007
Simon Taylor, Tuesday, 2 January 2007:
>
> > Why wouldn't num_functors just return 0 for such types? I don't
> > understand this behaviour.
>
> The intention is that if num_functors succeeds, other functions which
> only work for discriminated union types can be used. There are very
> few situations in which you want to use the result of num_functors
> without testing that it is greater than zero. I'd also argue that
> it doesn't make sense to talk about the number of functors of type
> `float', it just doesn't have functors at all.
>
> Also, it would be better to leave the interface alone rather than
> changing the return value because that change is more likely to
> silently break code rather than causing an error.
Taking this line, the documentation for num_functors should include this
justification. Julien and I spent about ten minutes trying to work this
out from the source code, but couldn't find an explanation.
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to: mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions: mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------
More information about the reviews
mailing list