Re: Structs

new topic     » goto parent     » topic index » view thread      » older message » newer message
irv said...

Things like this are often necessary and useful. So the dot notation shouldn't really stop at a single level:

You can do this today using Phix

enum X,Y 
 
sequence point = {0,0} 
 
point.X = 10 
point.Y = 20 
 
sequence position = {} 
position &= point 
? position 
--> {10,20} 
 
position = repeat( point, 4 ) 
? position 
 
position.2.X = 3 
position.2.Y = 5 
 
? position 
--> {{10,20},{10,20},{10,20},{10,20}} 
 
--> {{10,20},{3,5},{10,20},{10,20}} 
 
 
for i=1 to 4 do 
    position.i.Y = i 
end for 
? position 
--> {{10,1},{3,2},{10,3},{10,4}} 

_tom

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

Search



Quick Links

User menu

Not signed in.

Misc Menu