RE: sequence OF what? - structores
>From: Lucius Hilley <l3euphoria at bellsouth.net>
>Subject: sequence OF what? - structores
>Only thing I can figure you can get out of that is.
>Very fixed, non-dynamic typing.
>I know, you say, What?
Actually, I know what you mean. It's supposed to be fixed. Most of the
variables we use will be aggregates, long sequences containing lots of the
same type of value. Unfortunately, at the moment traditional type checking
is horribly slow. A 2 element sequence wouldn't take long, but to check a
1000-element sequence is too slow, cause traditional type checking has to
check every single element every time something changes. I don't mean for
the 'of' keyword to be appropriate for structures, that is a separate issue,
and totally transparent to the idea of "of".
>Using OF how would you type handle this?
>}}}
<eucode>
>sequence pb
>
>pb = {"Johnny", "Robert", "Princeton", "Jr.", 12, 31, 1977, 150, "blue",
>"blonde", 6, 2, 'M'}
></eucode>
{{{
As I said above, "of" doesn't affect structures at all. For an individual
element comprised of different types of values, a traditional type check
would need to be used. However, for the sequence comprised of these
structures:
type PhoneBookItem( sequence s )
... normal type checking, make sure that each value is ok ...
end type
type addressbook (sequence of PhoneBookItem s)
return 1
end type
addressbook directory
directory = {}
directory &= {pb}
>----
>I stand by my proposal... or should I say Chris Bensler's proposal of
>structures.
>Maybe, someone mentioned before him. I wouldn't doubt it. Either way.
>Something like this can handle it.
<SNIP>
>}}}
<eucode>
>struct PhoneBookItem
> {string, string, string, string, month, mday, year, string, string,
>feet,
>inches, gender}
>end struct
></eucode>
{{{
As you said, you don't know what to do with strings :oP
I don't know exactly what the best thing to do is regarding structures, but
if they become a type, then they can be used by the "of" system. No problem.
I don't mean to add anything new to the language as far as language
enhancements. The thing that "of" does, and the only thing that of does, is
allow user defined types to be USEFUL for anything other than simple things.
MrTrick
|
Not Categorized, Please Help
|
|