[mercury-users] Named constants?
Fergus Henderson
fjh at cs.mu.OZ.AU
Fri May 14 11:31:06 AEST 2004
On 13-May-2004, Peter Hawkins <peter at hawkins.emu.id.au> wrote:
> How does one create some sort of named constant in Mercury? (as one might do
> with a #define in C).
>
> Should I just do this?
> :- func my_constant = int.
> my_constant = 42.
Yes.
> Surely there is a more compact notation...
If you compile with `--infer-all', and the constant is only used in
one module, then the type declaration is optional. In that case,
the named constant definition is just
my_constant = 42.
which seems sufficiently concise to me.
--
Fergus Henderson | "I have always known that the pursuit
| of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.
--------------------------------------------------------------------------
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