[luatex] New \pdf... primitives

David Carlisle d.p.carlisle at gmail.com
Tue Nov 17 14:59:41 CET 2015


On 17 November 2015 at 12:32, Hans Hagen <pragma at wxs.nl> wrote:

>
> basically they are similar to how things are done at the lua end: a lookup
> based on name; then teh result is pushed back into the input
>
> that makes it possible to use \the etc (of course i don't mind making them
> just assignments and report token digits but that is definitely not
> compatible with what macro packages expect i.e. barking on \the)
>
> (i'll probably try to redo them some day using the lua token scanner but
> then i first need to add something to that)
>
> anyway, i did consider making a setter (\pdfvariable for variables) and that
> then the only way to get the value is to use \pdffeedback, also because at
> some point setting a variable is not per se reflected in its value, e.g.
> some states are frozen once the first page is flushed)
>
> (keep in mind that some never lived in the frontend)
>


Currently

\expandafter\def\csname pdf_horigin\endcsname{hello}

\edef\pdfhorigin{\pdfvariable horigin}


defines \pdfhorigin to be hello.  If this behaviour is
to be determined from the documented behaviour
then it seems that \pdf_horigin needs to be documented
as the new primitive name with \pdfvariable being documented
as some alternative syntax that expands to that.


If the \pdfvariable syntax is to be introduced it would be far more
natural to make it non expandable and so never exposing a csname for the
internal dimen register. (Still \the\pdfvariable horigin could expand
to the value
without having to expose \pdf_horigin)

Having several undocumented csnames which if redefined break
the documented behaviour of the \pdfvariable primitive seems
somewhat dangerous.


> but the current solution at least permits to do the same things as before (i
> have no clue how many of your users (can) use these low level primitives ...
> in context there has been backend abstraction layers for decades so there
> it's less an issue i guess)

I don't think number of users or level of abstraction is really the issue.
Someone (even if it's only Joseph and me) has to be able to maintain
the macro/format level interface to this and to be able to document/explain
the behaviour for any reasonable input.

Defining a command such as \pdf_compresslevel should not take the user
into undocumented
territory, and similarly using documented primitives such as

\expandafter\show\csname pdf_horigin\endcsname

should not show undocumented tokens whose behaviour can only be determined by
experimentation or reading the engine source.

The main difference between latex and context here is not really abstraction
but importance on maintaining compatibility at the input syntax level
across engines.
Obviously new functionality requires new syntax and sometimes the same syntax
will produce different output, but in general if someone wants to
switch a document from
pdflatex to lualatex there should be a small documented set of things
that need changing.
That isn't really an issue for context as you're luatex only.


>
> i'll change the error to
>
> ! unexpected use of \pdfvariable
>
> <to be read again>
> \relax
> l.3 \pdfvariable \relax
>
> fwiw

Thanks! That is much better in the error case, but the non-error case
is also problematic.

>
> Hans
>
>


David

I should say, that as usual you only get negative feedback on the
problematic things, hopefully
taken as constructive criticism from people trying to build a format
over the 0.85 engine.
All the good new features and bug fixes etc go without comment, that's
just the way it is:-)


More information about the luatex mailing list