Re: SS

new topic     » goto parent     » topic index » view thread      » older message » newer message

Chris Burch wrote:

> I actually quite like this idea too.
> 
> I see you could have structures within structures.
> 
> Under this definition, could you have a sequence contain structures?
> eg
> }}}
<eucode>
>    -- Define a structure
>    structure Point is
>       atom x, y
>    end structure
> 
> sequence my_sequence
> my_sequence = repeat(Point, 10)
> 
> my_sequence[5].x = 4
>
Yes, sequences of structures are possible and important but...

 my_sequence[5].x = 4

How is Eu to know that the object in [5] is a Point structure?
One solution would be run-time lookup. The object stored in [5] is tagged
as a Point. Eu then knows it must store 4 in one of a Point's members,
but which one?? At compile time Eu knows where x is only if it knows
what structure is in [5] (Other structures may have a member named 'x')
I don't know if I've explained that well, but the upshot is that it is
a can of worms, and very slow if possible at all.

The best possibility that I can see is for the programmer to tell Eu
what kind of structure to expect.
 For instance:
   <Point>my_sequence[5].x = 4
or
    Point:my_sequence[5].x = 4
or
    Point = my_sequence[5]
    Point.x = 4
or
   ???

With this information, Eu can generate the appropriate code, including
run-time verification that the object in [5] really is a Point.

KtB

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu