Re: Euphoria types of the POLL
Hayden McKay wrote:
>
> Could you show me how you would define a nested sequence, or an object pls
>
> ie:
> type this(object x) ; where x could be an atom or sequence
> type that(sequence s) ; where s is an array of nested sequences and atoms
Hi Hayden
The first variation is not specifically covered by the questions, so it would be
open for others to argue a different usage, BUT I think the same issue arises
here as with the "sequence of sequence" syntax.
The purpose of the syntax in the poll is to declare elements within a sequence.
So the base object must be a sequence. If the object could be either an atom or a
sequence, then you can't "declare" its elements to have a particular type or
name, since it may not have any.
In the second example, assuming the sequence of sequence syntax is implemented,
you could do this:-
type that( sequence of sequence x ) -- or
type array( sequence of sequence x )
If you wanted to constrain the array in some other way, you would need to add
code within the type block. The poll questions don't affect that.
If you wanted the base type to be a UDT array defined elsewhere, the same issues
wuld arise as with allowing a UDT on the LHS of an "of" expression, which I
commnented on in my "Postscript" to the last poll. Neither poll addresses this
issue, so it is open for you to argue it and perhaps make it the subject of a
future poll. The questions in the poll are limited to the idea of typing and/or
naming subscripts of an object of base type sequence.
I hope this clarifies.
Regards
Peter Robinson
|
Not Categorized, Please Help
|
|