Re: Eu improvements (part 3)
- Posted by c.k.lester <euphoric at cklester.com> Jan 04, 2007
- 573 views
Karl Bochert wrote: > > c.k.lester wrote: > > The assignment to my_line above would be an error because > my_line does not have an element named 'x' Yeah, I typoed... :/ > }}} <eucode> > my_line.start.x = 1 > my_line.start.y = 1 > -- or perhaps > my_line.start = mypoint > </eucode> {{{ > Also > }}} <eucode> > my_line.start = {1, 1} > </eucode> {{{ > is an error because '{1, 1}' is not a structured sequence. So what if it's not a structured sequence? It matches up to the Line sequence. Or you'd have to do: my_line.start.x = 1 my_line.start.y = 1 > Using {1, 1} requires 'inside knowledge' as to the layout of a Point. > Suppose the first element of a Point is a name?? > Suppose you want to add a field a few years from now?? True. Gotcha. I still think it should be allowed. Programmer beware. ;) > > It's a stricter definition of the 'type' or 'sequence.' Of course, this > > could > > always be managed outside the object's definition, but > > why not put it inside? > > > IMHO because we must keep it Euphoric (simple). Euphoria can be made simpler even as we speak, but I don't think there's anything you'd want stripped from it. I think adding 'where' is an addition to the language, not a complication. > > One concern I have is for working with databases. If I have a table that has > > about 20 fields (this is an actual case), and I want to import a record from > > it, how could this be done best using a structured sequence? > > > > my_record = get_db_record( 3 ) > > > > -- options > > my_record.field1 (field1, field2, etc.) -- no likey this much > > my_record.Field_Name -- better, but what about fields with spaces in them? > > my_record.'Field Name' > > my_record['Field Name'] -- very nice > > > > etc... > Are you trying to allow the name of an element of a structured sequence > to have a space in it?? Bad idea, I think. No, I was thinking of database fields. I don't usually put spaces in my database field names, and I don't even know if it's allowed in EDB or EuSQL (Matt?), but I was just covering all my bases. :) > Note that the structured sequence is data only.(no functions are attached) > Many elaborations are possible, initializers, verifiers, properties etc > but this is a simple language -- only the basic functionality should be > provided. I'm in full agreement of adding the basic functionality of structured sequences and leaving the advanced stuff to extended libraries. I was just brainstorming...