[m-dev.] switching on constant functions
Julien Fischer
juliensf at csse.unimelb.edu.au
Mon Dec 22 12:25:17 AEDT 2008
On Mon, 22 Dec 2008, Julien Fischer wrote:
>
> On Mon, 22 Dec 2008, Ian MacLarty wrote:
>
>> Hi,
>>
>> I'd like to be able to switch on the values of constant functions.
>> For example suppose I have the functions:
>>
>> :- func a = (string::(out(bound("a")))).
>> :- func b = (string::(out(bound("b")))).
>>
>> then I'd like to be able to write a switch like:
>>
>> % X has inst bound("a" ; "b") before the switch.
>> (
>> X = a,
>> ...
>> ;
>> X = b,
>> ...
>> )
>>
>> Would there be any objections to extending the language to handle this?
>> If not what would be the best way to implement it? I was thinking of
>> replacing constant functions, whose output is an inst with a single
>> value, by that value before or in the switch detection pass.
>
> What if the type involved is abstract and imported from another module?
Obviously the second follows from the first there ;-)
Julien.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to: mercury-developers at csse.unimelb.edu.au
Administrative Queries: owner-mercury-developers at csse.unimelb.edu.au
Subscriptions: mercury-developers-request at csse.unimelb.edu.au
--------------------------------------------------------------------------
More information about the developers
mailing list