On 2013–08–23 Hans Hagen wrote:
Is this prefix required? It breaks old code and required a branch in every new project. And I don't really see a reason for this incompatibility. Here is an example defining a new direction “foo”:
The MpIV code has namespace protection. Why run traditional in MkIV?
\starttext \startMPcode label("first", origin);
%% MkIV %% pair mfun_laboff.foo ; mfun_laboff.foo := (.5,-1) ; %% mfun_labxf.foo := mfun_labyf.foo := 1 ;
%% MkII pair laboff.foo ; laboff.foo := (.5,-1) ; labxf.foo := labyf.foo := 1 ;
label.foo("second", origin); \stopMPcode \stoptext
I wasn't aware of users defining extra ones. I'll add this:
Probably not many users will tinker with custom label directions, but MetaPost package authors do. Some packages like piechartmp¹ internally use laboff.foo and the mpfun_ prefix breaks those packages. They work in traditional MetaPost, plain TeX, LaTeX and ConTeXt MkII, but since mplib uses the mpfun_ prefix, those packages are broken in MkIV.
[…] installlabel.foo ( 0, 1, 1, (.5,-1) ) ;
This does not fix the problem since it only *defines* the correct variant, it doesn't help *using* those values. If the label values are being changed in the package one still has to branch out to support both variants. And even if there was an abstraction assisting to *use* the laboff values, all MetaPost packages tinkering with laboff would need to be adjusted. I can't imagine that to happen. Here's what the piechartmp package is doing, for instance: if laboff.@# = (-3,-3): % auto justification […] laboff.auto := ((cosd l),(sind l)) ; labxf.auto := ((cosd l) - 1) / -2 ; labyf.auto := ((sind l) - 1) / -2 ; […] This code is being executed every time a label is typeset. Marco ¹ http://mirrors.ctan.org/graphics/metapost/contrib/macros/piechartmp/piechart...