[Oberon] ANY type cast
Dan Parnete
dan.parnete at fastwebnet.it
Tue Apr 12 15:01:19 CEST 2005
Thomas Frey wrote:
>> I didn't found any documentation about ANY type, but it's easy to
>> understand it is another PTR. The only difference I've seen is that
>> only PACO compiler recognize it.
>> The question is: if it cast any POINTER and OBJECT why didn't cast
>> PONITER TO ARRAY OF CHAR? Or better, why only one direction? If we
>> have:
>> VAR data: ANY; str: Utilities.String;
>> the assignment
>> data := str;
>> is ok for the compiler, but the condition:
>> data IS Utilities.String , or the cast
>> data(Utilities.String) , or WITH data: Utilities.String DO
>> are not.
>> How can I recuperate the value pointed by data, witch in this case
>> is a string?
>
>
> ANY is an alias for PTR. It only works for OBJECT instances. A better
> keyword would be OBJECT but it is already taken by the OBJECT keyword
> for OBJECT-CLASS. To allow casting data(Utilities.String) the type
> guard code generated by the compiler would need to be changed.
>
> --Thomas
>
If ANY works only for OBJECT instance, it should not accept the
assignment data := str, isn't it?
Dan
More information about the Oberon
mailing list