[m-dev.] context "macros"

Julien Fischer juliensf at csse.unimelb.edu.au
Tue Mar 25 15:24:33 AEDT 2008


On Tue, 25 Mar 2008, Peter Wang wrote:

> What do you think of adding support for __file__, __pred__, __line__
> "macros"?  These would expand into strings or integers like the
> corresponding C macros.

I have often though something like this would be useful, particularly
given that the this_file/0 functions we use in the compiler don't
extend well when sub-modules are involved (you have to qualify them
if the parent also defines a this_file/0 function.)

> My concern was just about the syntax.  __foo__ has the advantages of
> following C and requiring no changes to the parser.

> __line__ is a
> little bit sticky for referential transparency, but __file__ and
> __pred__ would just act like variables assigned at the start of the
> predicate.

An alternative syntax suggestion: @line@, @file@ etc ...

I would also include __module__, __grade__, __time__ and
__date__ in the set.

__proc__ would be preferable than __pred__.

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