[m-dev.] context "macros"
Ian MacLarty
maclarty at csse.unimelb.edu.au
Thu Mar 27 10:32:07 AEDT 2008
On Wed, Mar 26, 2008 at 11:18:47AM +1100, Julien Fischer wrote:
>
> On Wed, 26 Mar 2008, Ralph Becket wrote:
>
>> Julien Fischer, Tuesday, 25 March 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 ...
>>
>> We haven't used the # symbol yet, as I recall.
>
> Yes we do, it is used with #line directives (ref. man 2.2).
>
> (On an slightly related matter I think we should replace pragma
> source_file with #file.)
>
It would be nice if we supported directives like:
#line 5 "source.m"
since then m4's --synclines option would work.
Ian.
--------------------------------------------------------------------------
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