[m-rev.] for review: arrays and the debugger

Zoltan Somogyi zs at cs.mu.OZ.AU
Mon Jun 18 13:15:09 AEST 2001


I wrote:
> library/std_util.m:
> 	Add a new predicate, limited_deconstruct, which usually does what
> 	deconstruct does, but fails (and does not allocate any memory) if
> 	the arity of the supplied term is beyond a given limit.

On 16-Jun-2001, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> Why not just use functor/3 to test the arity,
> and then call deconstruct/4 or not depending on the arity returned by
> fnuctor/3?

Performance. Doing that would require interpreting the RTTI structures twice.
For discriminated union types, one of the most common data structures, that is
reasonably expensive. The extremely small risk of bumping into the limit is not
worth it.

One of Henry Spencer's proverbs puts it this way: "carrying a net before you
in case you trip is usually wasted effort".

Zoltan.
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list