David Korn schrieb:
cc:  [EMAIL PROTECTED]
Subject: Re: [ast-developers] Initialisation of type variables
--------

I noticed that

   typeset -T X_t=(
        typeset a=aha
        typeset b=${_.a}
   )

   X_t x
   print ${x.b}

prints nothing. Is this intended or a bug? The corresponding case
Currently the value of _ is currently unspecified in this case.
Are you suggesting that _ be defined for any compound assignment
or just during a type definition?

IMHO it would be best if the statements were done in order, as this is what most users will expect. It would also be desirable that a statement could use the value of a previously assigned variable. For example, variable 'a' above might be an initial value used by several subsequent typedefs. To achieve this, _ would have to be defined during a type definition. I can't see at the moment if it will be of any use in a compound assignment. I guess not.

A related question: As ksh now is going object oriented, what about using _() as a constructor and calling it automatically when a variable of this type is defined?
I have been thinking about using the name create in this case so that
if you define a function named create, it will be invoked when each
instance is created.

Well, the name doesn't matter, though I would consider _() a bit more natural, as it emphasizes the function's special character. And if you introduce 'create' later, it might collide with a normal user function (actually you can already define _(), but I guess the probability is muss less here).

Regards,
Bernd

--
Bernd Eggink
[EMAIL PROTECTED]
http://sudrala.de
_______________________________________________
ast-developers mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-developers

Reply via email to