[m-dev.] synthesized user event attributes
Mark Brown
mark at csse.unimelb.edu.au
Wed Jan 17 16:34:11 AEDT 2007
This question is mainly for Zoltan, but any other views are welcome.
We currently support synthesized attributes for user defined events by
putting something like the following in the specification file:
event foo(
a1: foo,
a2: bar,
a3: baz synthesized by f(a1, a2),
f: function
)
Here the attribute a3 is synthesized by applying the last attribute to the
first two. The type of f is inferred from the way it is used in synthesizing
a3 -- in this case the type is `func(foo, bar) = baz'.
A problem with this is that we assume the function is pure when that may
not be the intent. In fact I imagine it would be quite common to use a
semipure or impure function for this purpose.
One solution is to allow purity annotations in the specification. Something
like
event foo(
a1: foo,
a2: bar,
a3: baz synthesized by f(a1, a2),
f: semipure function
)
so that the type of f is inferred to be `semipure func(foo, bar) = baz'.
A simpler solution would be to assume `impure', which would work but would
cause a bit of inconvenience in the case that the function really is pure.
I prefer the first approach. Any objections before I start implementing
this?
Cheers,
Mark.
--------------------------------------------------------------------------
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