Subject: bug#31742: 26.1.50; excorporate.elc byte-compiled in Emacs 25.x fails in Emacs 26.1

From: Noam Postavsky <[email-masked]>
Date: Sat, 09 Jun 2018 08:13:03 -0400

>> The `(aref element 0)` trick is the only one that `soap-client` uses.  All
>> other struct usage is via accessor functions, the rest of the code does not
>> assume they are vectors.  It seems to me that `cl-old-struct-compat-mode` is
>> not needed.

> I went back and tested with cl-old-struct-compat-mode disabled, with the
> soap-type-of patch, and I get an earlier failure, via M-x excorporate:

>  So at least for Excorporate, cl-old-struct-compat-mode is
> needed (in addition to the (aref ... 0) -> (soap-type-of ...)
> soap-client change).

Yeah, and for (type-of element) to properly substitute for (aref element
0) without cl-old-struct-compat-mode you would need

(defun soap-type-of (element)
  "Return the type of ELEMENT."
  (let ((type (type-of element)))
    (unless (eq type 'vector)           ; For Emacs 25 and earlier.
      (setq type (aref element 0)))
    (if (string-match "\\`cl-struct-" (symbol-name type)) ; Old-style struct.
        (intern (substring (symbol-name type) (match-end 0)))
      type)))

But since cl-old-struct-compat-mode activates automagically, may as well
take advantage of it.