[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ast-developers
Subject:    Re: [ast-developers] Initialisation of type variables
From:       Bernd Eggink <monoped () sudrala ! de>
Date:       2008-09-15 17:01:08
Message-ID: 48CE94D4.4050909 () sudrala ! de
[Download RAW message or body]

David Korn schrieb:
> cc:  monoped@sudrala.de
> 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
monoped@sudrala.de
http://sudrala.de
_______________________________________________
ast-developers mailing list
ast-developers@research.att.com
https://mailman.research.att.com/mailman/listinfo/ast-developers
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic