Re: Eu improvements (part 4)
- Posted by Pete Lomax <petelomax at blueyonder.co.uk> Jan 06, 2007
- 669 views
Pete Lomax wrote: > Yeah, Cut that middle bit of nonsense, subsequences rule, no flattening: > }}} <eucode> > type Point(sequence p) > enum integer x, y -- x=1, y=2 > -- if length(p)!=2 then return 0 end if -- automatic > -- if not integer(p[1]) then return 0 end if -- automatic > -- if not integer(p[2]) then return 0 end if -- automatic > return 1 > end type > > type Point_3D(sequence q) > enum Point p, integer z -- p=1, z=2 > -- if not Point(q[1]) then return 0 end if -- automatic > -- if not integer(q[2]) then return 0 end if -- automatic > return 1 > end type > > Point_3D A > A={{1,1},1} > ?A.p.x -- same as A[1][1], note A[p][x] gives p undefined > -- and A[1][x] gives x undefined > ?A.p.y -- same as A[1][2], note A[p][y] gives p undefined > -- and A[1][y] gives y undefined > ?A.z -- same as A[2], note A[z] gives z undefined > </eucode> {{{ > Agreed, you're right, much happier with that now. Yes, obviously you can put user defined code above the return 1. Thanks, Pete