From: Bruno H. <br...@cl...> - 2017-12-23 21:45:44
|
Hi Don, > Bruno Haible writes: > > > Consider (macroexpand-1' > > > (LOOP for (i j k) of-type (fixnum) across #()) > > > > Who says that this should expand to something reasonable? > > > > Citing 6.1.1.7 "Destructuring" > > > "When aligning the trees, an atom in the tree of type specifiers > > that matches a cons in the variable tree declares the same type > > for each variable in the subtree rooted at the cons." > > > > So this form declares I as being of type FIXNUM and J and K as > > being of type NIL. > > My interpretation of > an atom in the type specifier matches a cons in the variable tree > would be fixnum matching (i j k) in > (LOOP for (i j k) of-type fixnum ...) > so in that case i,j,k would all be declared fixnum, Yes. > but in (LOOP for (i j k) of-type (fixnum) ...) > I would expect the atom fixnum to match only i, Yes, agree. > and I would NOT > expect of-type (fixnum) to mean the same as of-type (fixnum nil nil) > so I would expect j and k to be of unspecified type. Here you have assumed that the type specifier has a list structure with some kind of "optional" semantics. However, 6.1.1.7 is clear about: A type specifier for a destructuring pattern is a tree of type specifiers ... with tree n. 1. a binary recursive data structure made up of conses and atoms So the type specifier (FIXNUM) has to be read/interpreted as (FIXNUM . NIL). Bruno |