[mercury-users] full and empty lists
David Overton
dmo at cs.mu.OZ.AU
Tue Jan 15 11:26:23 AEDT 2002
On Mon, Jan 14, 2002 at 11:00:41PM +1100, Dave Slutzkin wrote:
>
> The mode benefits only come from full_timeline 'promising' a non-empty list.
> The other benefits I was hoping for were modularity, and implementation
> hiding. So I could theoretically change the implementation of timeline from
> list to something else (which is likely) without having to change any
> existing code.
>
> > As Ralph pointed out, the determinism analysis won't currently detect
> > that empty_timeline and full_timeline are mutually exclusive and
> > exhaustive (although there is someone working on allowing you to promise
> > this). However, as far as _modes_ are concerned, using the constructors
> > directly instead of wrapping them in appropriately declared predicates
> > should make no difference.
>
> So if I have:
>
> Line = [_|_]
>
> then I still get the mode benefit?
Yes.
> I suppose the compiler still knows that
> it must be a non_empty_list... I hadn't tried that, but that would be a
> part-solution to my problem. (And I'll try it as soon as I get back to my
> machine.)
>
> So I've got the mode benefits, but still sorta without the hidden
> implementation that would be the ultimate.
Yes, you will need to wait until the exclusive/exhaustive declarations
are implemented before you can do what you want.
David
--
David Overton Department of Computer Science & Software Engineering
PhD Student The University of Melbourne, Victoria 3010, Australia
+61 3 8344 9159 http://www.cs.mu.oz.au/~dmo
--------------------------------------------------------------------------
mercury-users mailing list
post: mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the users
mailing list