[mercury-users] Constructor question.
Michael Richter
ttmrichter at gmail.com
Sat Apr 14 21:42:12 AEST 2012
On 14 April 2012 19:32, Michael Richter <ttmrichter at gmail.com> wrote:
> On 14 April 2012 19:21, Ian MacLarty <maclarty at csse.unimelb.edu.au> wrote:
>
>> > You can also do something like this:
>>
>
>> Foo ^ bar = 10,
>> Foo ^ baz = "eleven",
>> Foo ^ quux = yes,
>>
>
> OK, I … am duly chastened. I hadn't even thought of doing it that way. I
> was constantly messing with :=.
>
OK, I'm still lost, I'm afraid. Given this type declaration:
:- type foo(bar::int, baz::string, quux::bool).
How would I instantiate this using the system you show?
:- func default_instance = (foo::out) is det.
default_instance = <what code do I put here?>
I've tried a few ways to do this, with = or :=, explicitly naming the
return variable and separating it from the instantiation code with :- (and
a few other more desperate attempts) and I'm just not having any luck.
--
"Perhaps people don't believe this, but throughout all of the discussions
of entering China our focus has really been what's best for the Chinese
people. It's not been about our revenue or profit or whatnot."
--Sergey Brin, demonstrating the emptiness of the "don't be evil" mantra.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurylang.org/archives/users/attachments/20120414/3f1c3767/attachment.html>
More information about the users
mailing list