Old-style backquote and ,@ in *.by files

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Old-style backquote and ,@ in *.by files

Stefan Monnier
Hi,

We're in the process of getting rid of support for old-style backquote
(of the form (` e) and (, e)) and we bumped into the following situation
(which triggered some signal on our side):

In admin/grammars/make.by (and other grammar files) we find things like:

    Makefile : bol newline (nil)
             | bol variable
               ( ,@$2 )
as well as

    targets: target opt-whitespace targets
             ( (car ,$1) (car ,@$3) )

But in Emacs-25, the above "(car ,@$3)" was read assuming the ,@ is
a new-style unquote, i.e. it's read as "(car (\,@ $3))", whereas the
earlier "( ,@$2 )" was read as "(\,@$2)", i.e. as a single list
containing a funny symbol named ",@$2".

I think this was a bug, which would be fixed by dropping support for
old-style backquotes, so that "( ,@$2 )" would now be read as "((\,@
$2))".

But I'm not sufficiently familiar with the bovine code to be sure
(especially since misinterpreting "( ,@$2 )" as "(\,@$2)" would likely
have been noticed, so either it's really what was intended, or else
there's presumably somewhere some hack that tries to work around this
quirk).  In bovine-grammar-expand-form, I see:

        (when (and (>= emacs-major-version 24)
                   (listp first)
                   (or (equal (car first) '\,)
                       (equal (car first) '\,@)))
          (if (listp (cadr first))
              (setq form (append (cdr first) form)
                    first (car first))
            (setq first (intern (concat (symbol-name (car first))
                                        (symbol-name (cadr first)))))))

which makes me think that maybe "(\,@$2)" is indeed what was intended,
and this code is designed to turn "(car (\,@ $3))" into "(car \,@$3)",
so that both ways to read work (the new-style reading is transformed
into the old-style reading).

Could you shine some light for us?


        Stefan