[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Order of Initialization

>I think one should not depend on the order.  

I agree, however, there may be cases where the order does matter.

>Consider the ambiguity
>resulting from two class definitions:
>(defclass c1 ()
>   ((x :initform (initx1))
>    (y :initform (inity))))
>(declass c2 (c1)
>   ((x :initform (initx2)))
>These can be in a file in either order.  Which order for eveluation of
>(initx2) and (inity) do you think is correct.  I can think of arguments
>for both.  Further, consider
>(defclass c3 (c1)
>   ((z :initform (initz))
>    (y :initform (inity2))
>    (x :initform (initx3))))

In this particular example, the class precedence list for C1
would be:

the initializer for the X slot would be INITX2, and the initializer for 
the Y slot would be INITY.
For C2, the class precedence list would be:


and, according to the rules on pg. 1-8:1-9 of 87-002 (and
provided it is decided to stick with them), the initializer
for X would be INITX2 and that for Y would be INITY. If
one uses the class precedence list to impose a global ordering
on initialization, and the lexical order within the class
to impose a local ordering, one could argue that the initialization
order INITX2, INITY would make sense.

>So my choice is 3, the user should not depend on the