[mercury-users] Bit-fields in Mercury

Ian MacLarty maclarty at csse.unimelb.edu.au
Tue Jul 11 11:28:16 AEST 2006


On Tue, Jul 11, 2006 at 08:56:20AM +1000, Michael Day wrote:
> 
> > This is more usable, but you are still left with the problem that it
> > does not allow the use of (often sensible) defaults.
> 
> You could add defaults like this:
> 
> :- func opts = opt.  % returns default options
> 
>     f(..., (opts ^ network := disable) ^ parallax := reverse)
> 
> Of course, then you run into the clunky nested parentheses required by the
> syntax for multiple field assignments.
> 
> Something that would be quite handy but perhaps beyond the scope of
> Mercury is an assoc_list with an association between the value of the key
> and the type of the associated value.
> 
> Currently the only way to get this kind of thing is like this:
> 
> :- type opt
>     --->    opt1(int)
>     ;       opt2(string).
> 
> :- type opts == list(opt).
> 
> When sometimes you would like to separate option names and values:
> 
> :- type opt
>     --->    opt1
>     ;       opt2.
> 

Could you give an example where that would be useful.  Why not just
ignore the argument(s) if you're not interested in them?

Ian.
--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at csse.unimelb.edu.au
administrative address: owner-mercury-users at csse.unimelb.edu.au
unsubscribe: Address: mercury-users-request at csse.unimelb.edu.au Message: unsubscribe
subscribe:   Address: mercury-users-request at csse.unimelb.edu.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list