Re: Eu improvements (part 4)
- Posted by c.k.lester <euphoric at cklester.com> Jan 05, 2007
- 668 views
Karl Bochert wrote: > c.k.lester wrote: > > I messed up the paradigm... here it is corrected: > > c.k.lester wrote: > <snip earlier messages> > > newInstance("automobile_database","myCars") > > so 'myCars' is now a database of automobiles. > > this really should be > > auto = newInstance("automobile") > > or better > > newInstance("automobile","auto1") > > which creates a new automobile called auto1. > > With this paradigm, we have no global constants required. > > -- modify a property > > property("auto1","maker","Ford") > > -- add the auto to the database > > addObject("myCars","auto1") > This 'OOP as a mindset for using functions' may work for some, but I find > it very difficult to read or understand. I was simply applying my lists functionality to OOP functionality (I thought you were wanting OOP stuff). It basically has nothing to do with OOP, but can be used in that way. > My posts were about 2 features that might make me a Euphorian again: > . Pass By Reference Don't know why this is needed. Can you give an example where PBR is required? > . Structured Sequences Yes. Gimme. :) > not about OOP or ways to implement it. Sorry, that was just a tangent I thought I was following you on! heh. > With that in mind, I would ask those who disagree which category > they place themselves in: > 1) Good ideas, but flawed implementation > 2) I don't like PBR > 3) I don't like SS > 4) Both are instruments of the devil > 5) Irrelevant -- Euphoria is perfect I'm in the "Euphoria is perfect... and would be even more perfect with structured sequences!" :D Adding structured sequences would not break anything, and would give us a more powerful language syntax but still keep it all simple.
type text(sequence s) return is_all_ascii( s ) end type sequence Company is text name Address headquarters --... end sequence sequence automobile is Company maker text model atom year --... end sequence
Although, I still don't like the use of static variable names. For example, what if we create a huge program with lots of includes and code and has the automobile.maker text all throughout but we want to change the definition to Company manufacturer at some point, thus breaking all that code (which now needs to be automobile.manufacturer)? Oh, well, this should all be in a database anyway. :) How about instead of sequence Company is --... end sequence we use record Company --... end record because that's really what it seems to be: a database record.