Re: Euphoria Object Oriented Programming
- Posted by Matt Lewis <matthewwalkerlewis at gmail.com> Jan 02, 2007
- 1095 views
ChrisBurch2 wrote: > > > I agree. I do not think OOP should be added to the base, unless it is > completely > transparent, and does not affect the way a lot of people use euphoria. > > Which in itself raises an interesting wuestion - how do a lot of people use > euphoria? As a person who has created an OOP version of Euphoria, I'll admit that I'm not a huge fan of OOP, although it definitely has some nice features that I occaisionally like to use. The main way that I suspect I personally would use ooeu's oo features is for creating complex data structures. Of course, these end up being simply sequences. The main value is, admittedly syntactic sugar for being able to use dot notation and member names that don't pollute the namespace. This is an issue that has [rightly] come up many times around here, and I think that the ooeu solution is a pretty good one that stays true to the Euphoria way of doing things. You also get other nice things, such as methods that are explicitly tied to the data. It ends up being a way to organize your code. It's obvious that certain routines apply to certain types of data. By using inheritance, you can reuse code fairly easily and in a way that's semi-self documenting. None of this changes any current euphoria functionality. It's true, of course, that if you want to use OOP-style code that others have written, you may need to use some OOP yourself. Alternatively, someone could simply wrap the OOP with straight eu-style procedural routines, assuming that you really, really don't want any dots in your code. Since I'm not a big OOP fan, some may wonder why I wrote ooeu. The short answer is, because I could. A lot of my projects start out that way. But also, there's more to ooeu than OOP: * goto (static and dynamic) * pass by reference * find_from()/match_from() * eval()/embeddable scripting engine * var_id()/read_var()/write_var()/dump_var() We talk a lot about features that we'd like to see in eu, and when Rob put out the eu-in-eu, I thought it would be a great idea to try some of these things out, to see how they might work. When Rob opened up the backend, too, it just got even better. I see ooeu less as a fork of eu than as an alternative testing branch of development. Matt