Re: Re[2]: (Another) (small) Eu 2.5 feature request.
- Posted by Derek Parnell <ddparnell at bigpond.com> Sep 23, 2004
- 464 views
irv mullins wrote: > > unknown wrote: > > > > >> Can cause ambiguity.. although it is nice looking > > >> > > >> what does a.b.2 mean? a[b][2] or a[b[2]] ? > > >> > > W> a[b][2] > > W> however since you brought it up, > > W> a.b..2 > > W> could mean > > W> a[b[2]] > > > > a.b..2 can also mean a[b..2] > > > > hehehe :D > > better use another syntax? > > Here you see the reason subscripted sequences are not a substitute > for real structures. Even though structures would make Euphoria > code safer and clearer ... And slower. Assuming of course that a struct is a vector that cannot change its length, that each element is given a name, and each element's datatype is set at definition time. Slower because there would be three fundamental changes to the inner interpreter. It would have to support the idea of fixed-length sequences, the idea of fixed-datatype sequence elements, and a new scope level - that of sequence, as element positions would have names as well as numeric indexes. I imagine your are hoping for something like ... struct customer sequence PersonalName sequence FamilyName sequence Address integer ZIPcode integer CustNumber end struct customer CurrentCust CurrentCust.PersonalName = "Derek" CurrentCust.FamilyName = "Parnell" CurrentCust.CustNumber = newnumb() In which case, the interpreter would need to add extra checks to append(), prepend(), &, slicing and assignment to make sure it was not changing the target's length, or datatypes. I agree that this could make for safer and clearer code, but at the cost of execution speed. Some people get a bit worried about that aspect. -- Derek Parnell Melbourne, Australia