[m-dev.] context "macros"

Ian MacLarty maclarty at csse.unimelb.edu.au
Fri Mar 28 10:53:54 AEDT 2008


On Thu, Mar 27, 2008 at 03:27:04PM +1100, Julien Fischer wrote:
>
> On Thu, 27 Mar 2008, Ian MacLarty wrote:
>
>> 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.
>
> Out of curiosity, why do you want it to work?
>

Besides __line__ and __file__, I use m4 macros for complex trace goal
conditions that I use repeatedly (or at least I want to, but currently
don't because the lines become out of sync).

In one spot I use m4 to conditionally disable some modes of a predicate
that rely on insts that are generated by the program containing the
predicate (i.e. avoid a bootstrapping problem).

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