[metapost] Bug? Parsing def := := enddef;

Taco Hoekwater taco at elvenkind.com
Thu Jan 21 10:18:14 CET 2010


Nicola wrote:
> In article <4B57FF3D.30800 at elvenkind.com>,
>  Taco Hoekwater <taco at elvenkind.com> wrote:
> 
>> Nicola wrote:
>>> But the following gives an error:
>>>
>>> This is MetaPost, version 1.208 (kpathsea version 3.5.7dev)
>>> **\relax
>>>
>>> *def := := enddef;
>>> ! Missing `=' has been inserted.
>>> <to be read again> 
>>>                    :=
>>> <*> def := :=
>>>               enddef;
>>> ? 
>>>
>>> That looks like a small bug. Taco, can you confirm?
>> Confirmed. Whether this is a 'fixable' bug remains to be seen,
>> I will investigate.
> 
> Actually, I've noticed that both
> 
> def := = enddef;
> 
> and
> 
> def = := enddef;
> 
> are ok (and similarly for vardef). The sense may be: if you are 
> redefining ':=' you are not allowed to use it in the definition header 
> itself (and similarly for '='), for the simple reason that you are 
> changing its meaning. So, I think this is actually expected behaviour. 
> Really, in The METAFONTbook, := is never used in a macro header, so this 
> might be the only reason why it exists (to allow the user to redefine =)!

Stefan, if you are reading this, can you add a note to this effect to
the manual?

The solution for plain 'def' is pretty straightforward, but the one
for 'vardef' would be quite ugly, so I'd rather not patch the executable
for this.

Best wishes,
Taco


More information about the metapost mailing list