1. New Language
- Posted by Mike Nelson <mikestar13 at sbcglobal.net> Sep 24, 2006
- 622 views
- Last edited Sep 25, 2006
I'm in the process of developing a Euphoria-based OOP language. It will be essentially similar to my Method Euphoria library, but will have a much cleaner syntax and should execute faster. In particular, I am developing a pure Eu complier which will be able to remove much of the OO overhead when the code allows. For example, if I define class X in a program and it has no subclasses then I call a method on a variable declared as X, no method lookup needs to be done: the method call can be translated into a direct routine call. I have translated the Method Eu standard library into the syntax of the new language and it is quite clean and readable. The open sourcing of Eu 3.0 opoens the possibility of a custom interpreter by modifying the fronmt end and attaching it to the C backend. I will be looking into this possibiltity as well--one that was not realistic before due to the speed limitations of the PD interpreter.
2. Re: New Language
- Posted by Al Getz <Xaxo at aol.com> Sep 24, 2006
- 583 views
- Last edited Sep 25, 2006
Mike Nelson wrote: > > I'm in the process of developing a Euphoria-based OOP language. It will be > essentially > similar to my Method Euphoria library, but will have a much cleaner syntax and > should execute faster. In particular, I am developing a pure Eu complier which > will be able to remove much of the OO overhead when the code allows. For > example, > if I define class X in a program and it has no subclasses then I call a method > on a variable declared as X, no method lookup needs to be done: the method > call > can be translated into a direct routine call. I have translated the Method Eu > standard library into the syntax of the new language and it is quite clean and > readable. > > The open sourcing of Eu 3.0 opoens the possibility of a custom interpreter by > modifying the fronmt end and attaching it to the C backend. I will be looking > into this possibiltity as well--one that was not realistic before due to the > speed limitations of the PD interpreter. Hi Mike, Yeah, the speed of the current Eu/in/Eu source held me back from doing anything too serious with it also. I built a nice debugger but it takes forever to load a big program (5 or more seconds sometimes). Done in the Open Eu C source this would probably be much much better. Take care, Al E boa sorte com sua programacao Euphoria! My bumper sticker: "I brake for LED's" From "Black Knight": "I can live with losing the good fight, but i can not live without fighting it". "Well on second thought, maybe not."
3. Re: New Language
- Posted by Pete Lomax <petelomax at blueyonder.co.uk> Sep 25, 2006
- 595 views
- Last edited Sep 26, 2006
On Sun, 24 Sep 2006 13:41:01 -0700, Mike Nelson <guest at RapidEuphoria.com> wrote: >I'm in the process of developing a Euphoria-based OOP language. It >will be essentially similar to my Method Euphoria library, but will >have a much cleaner syntax Do you have any specs/design/examples? In particular side-by-side demos which extol the virtues, eg: OO:
return call_method(o,"length",{})
procedural:
if o[tag]=CAR then return o[CAR_LENGTH] elsif o[tag]=BOAT then return o[BOAT_LENGTH] ...
Though obviously a bit more involved. Possibly start with the very first program you hope to get running and the coolest example you can think of that will only start working sometime nearer the release date perhaps with some example mods or bugfixes which are trivial in OO but fiddly and all over the place in the equivalent procedural code? Not that I'm a particular fan of OO programming or anything... Regards, Pete
4. Re: New Language
- Posted by Mike Nelson <mikestar13 at sbcglobal.net> Sep 26, 2006
- 597 views
Pete Lomax wrote: > Do you have any specs/design/examples? In particular side-by-side > demos which extol the virtues, eg: > OO: > }}} <eucode> > return call_method(o,"length",{}) > </eucode> {{{ > procedural: > }}} <eucode> > if o[tag]=CAR then return o[CAR_LENGTH] > elsif o[tag]=BOAT then return o[BOAT_LENGTH] > ... > </eucode> {{{ > Though obviously a bit more involved. Possibly start with the very > first program you hope to get running and the coolest example you can > think of that will only start working sometime nearer the release date > perhaps with some example mods or bugfixes which are trivial in OO but > fiddly and all over the place in the equivalent procedural code? > > Not that I'm a particular fan of OO programming or anything... > > Regards, > Pete We already have:
return call_method(o,"length",{})
this is the correct Method Euphoria syntax. My new language will render it as the much more readable
return o.length()
There will still be support for the advantage of the former sytax: the method name might be a variable, allowing indirect calling:
string x="length" return System.call(o,x)
Here are two classes to whet the appetite while I'm working on the project:
class Container_Extension extends General_Container General_Container base method shared Container_Extension new(General_Container base) Container_Extension me if base=nothing then throw Null_Reference.new() end if me=super() me.base=base return me end method method Container_Extension clone() Container_Extension me me=super() me.base=this.base.clone() return me end method method boolean base_is(type t) if this.base.is(Container_Extension) then return this.base.base_is(t) else return this.base.is(t) end if end method method type base_type() if this.base.is(Container_Extension) then return this.base.base_type() else return this.base.type() end if end method method protected call_failed(Exception reason,string name,array parameters) if reason.is(Undefined_Method) then System.call(this.base,name,parameters) else throw(reason) end if end method end class class Locking_Container extends Container_Extension public integer locked method Locking_Container clone() Locking_Container me me=super() me.locked=false return me end method method integer insert(array parameters) if this.locked then throw Locked_Container.new() else return super(paramters) end if end method method any remove(array prameters) if this.locked then throw Locked_Container.new() else return super(parameters) end if end method method clear() if this.locked then throw Locked_Container.new() else return super() end if end method method lock() this.locked=true end method method unlock() this.locked=false end method end class
The Container_Extension class is a framework to facilitate the writing of wrapper classes to add functionality to containers. The Locking_Container class is a specific implementation--pass a Queue or a Map to its constructor and you add the capabilty to lock and unlock the container. Only the methods which are affected by locking are defined. Any other methods of the underlying container result in the call_failed method bieng invoked with a Undefined_Method exception. The call_failed method uses System.call to indirectly call the method on the underlying container. This allows a kind of multiple inhertience or runtime inheritence without all the problems of building it into the basic class structure.
5. Re: New Language
- Posted by Kenneth Rhodes <ken_rhodes30436 at yahoo.com> Sep 26, 2006
- 581 views
Mike, Should this new euphoria based OOP language be considered a fork of Euphoria or an actual new language written in Euphoria? I have a suggestion for a name which should appeal to both open source and OOP fans... why not call it, "Mantra". Ken Rhodes Folding at Home: http://folding.stanford.edu/ 100% MicroSoft Free SuSE Linux 10.0 No AdWare, SpyWare, or Viruses! Life is Good,
6. Re: New Language
- Posted by Mario Steele <eumario at trilake.net> Sep 26, 2006
- 569 views
Hey Mike, Interesting design, very similar to the way Ruby does it's OOP design. I take it the following definitions are:
method protected call_failed(Exception reason, string name, array parameters) public integer locked
protected means that it can only be called within the Class itself, and public integer means that it's an Instance Variable? I'd be interested in seeing how this language evolves, as I'd like to see where it goes from here. Mario Steele http://enchantedblade.trilake.net Attaining World Dominiation, one byte at a time...
7. Re: New Language
- Posted by Mike Nelson <mikestar13 at sbcglobal.net> Sep 26, 2006
- 590 views
Mario Steele wrote: > Interesting design, very similar to the way Ruby does it's OOP design. I take > it the following definitions are: > > }}} <eucode> > method protected call_failed(Exception reason, string name, array parameters) > public integer locked > </eucode> {{{ > protected means that it can only be called within the Class itself, and public > integer means that it's an Instance Variable? > > I'd be interested in seeing how this language evolves, as I'd like to see > where > it goes from here. > Protected means callable from the class itself or a subclass; private speciefies callable from the class only. Methods may also use the "public" keyword, but methods are public by default. Instance variables are private by default; a public or protected designation autogenerates an accessor (get) method which has the same name as the variable and returns its value. Mutator (set) methods must be coded explicitly. So the above declaration is sytactic sugar for:
integer locked
method integer locked }}}
8. Re: New Language
- Posted by Mike Nelson <mikestar13 at sbcglobal.net> Sep 27, 2006
- 588 views
Kenneth Rhodes wrote: > Should this new euphoria based OOP language be considered > a fork of Euphoria or an actual new language written in Euphoria? > > I have a suggestion for a name which should appeal to both open > source and OOP fans... why not call it, "Mantra". I consider it a new Euphoric language. There will be no attempt at backward compatibiltity with Eu itself or even the Method Eu library. What I am envisioning is a language which is OOP from the ground up but has much of the essential power and flavor of Eu. The suggestion of Mantra is a very good one but I googled it and found the name already taken. For the moment, I am going with the name Methodica: this is inspired by Method Euphoria which is the primary inspiration for the language (with important secondary influences from Ruby and Eiffel).
9. Re: New Language
- Posted by Derek Parnell <ddparnell at bigpond.com> Sep 27, 2006
- 582 views
Mike Nelson wrote: > I consider it a new Euphoric language. There will be no attempt at backward > compatibiltity with Eu itself or even the Method Eu library. What I am > envisioning > is a language which is OOP from the ground up but has much of the essential > power and flavor of Eu. I fully encourage you with this idea Mike. However, being the intrusive bastard that I am, I have a couple of suggestions for you Have you considered making all members (data and methods) 'private' by default? This makes objects a lot more robust as access from outside the class must be explicitly granted by the class designer. Have you considered implementing 'class properties'? These behave to the outside as if they are data members but are actually implemented as member functions. Each property can have multiple 'setter' and 'getter' functions. For example: class Quad integer h integer l integer a procedure ctor() h = 0 l = 0 a = 0 end procedure procedure ctor(integer pH, integer pL) h = pH l = pL a = h * l end procedure procedure ctor(integer pA) h = floor(power(pA, 0.5)) l = h a = h * l end procedure property height function get() return h end function function get(sequence) return sprintf("%d", h) end function function set(integer pH) if pH > 0 then h = pH a = h * l -- recalc area else throw exception("Height must be +ve") end if end function end property property length function get() return l end function function get(sequence) return sprintf("%d", l) end function function set(integer pL) if pL > 0 then l = pL a = h * l -- recalc area else throw exception("Length must be +ve") end if end function end property property area function get() return a end function function get(sequence) return sprintf("%d", a) end function end property end class and used thus ... object f f = Quad(7,8) ? f.area -- displays 56 f.length = 5 ? f.area -- displays 35 f.length += 1 ? f.area -- displays 42 ? f.height -- displays 7 ? f.length -- displays 6 ? f.h -- Not accessible error. f.area = 36 -- Member is read-only Properties add more robust abstraction without making coding onerous. -- Derek Parnell Melbourne, Australia Skype name: derek.j.parnell
10. Re: New Language
- Posted by Mario Steele <eumario at trilake.net> Sep 27, 2006
- 613 views
Mike Nelson wrote: > I consider it a new Euphoric language. There will be no attempt at backward > compatibiltity with Eu itself or even the Method Eu library. What I am > envisioning > is a language which is OOP from the ground up but has much of the essential > power and flavor of Eu. > > The suggestion of Mantra is a very good one but I googled it and found the > name > already taken. For the moment, I am going with the name Methodica: this is > inspired > by Method Euphoria which is the primary inspiration for the language (with > important > secondary influences from Ruby and Eiffel). Interesting. My question is really, is Methodica going to have the ability to create IL Files, and be able to bind to an executable, like Euphoria has now, or OOEU has? Also, open source, closed source, or what have ya? Mario Steele http://enchantedblade.trilake.net Attaining World Dominiation, one byte at a time...