1. Object Oriented Programming
- Posted by Joe Otto <jotto at NETZERO.NET> Jun 29, 1999
- 655 views
- Last edited Jun 30, 1999
Hello all... When I first learn a new programming language I usually pick a project to get accustomed to the syntax, etc. When I started learning Euphoria I decided to write an OOP library. I'm getting close to completing the alpha version. It's loosely modeled after the way C++ handles objects. Here's a preliminary feature list: Reasonably straightforward syntax Virtual methods that can be overloaded by child classes Inheritance from multiple base classes Class-wide common variables and constants Data hiding through the use of Public, Protected, and Private access Type-checking User-defined object persistence Accessed by reference Passing as arguments to subroutines by reference is implied and automatic If anyone's interested: 1) Let me know and I'll post it when it's usable 2) I'll probably need help writing a demo using it 3) Feel free to suggest features I may have forgotten Thanks... Joe ________________________________________________________ NetZero - We believe in a FREE Internet. Shouldn't you? Get your FREE Internet Access and Email at http://www.netzero.net/download/index.html
2. Re: Object Oriented Programming
- Posted by David Cuny <dcuny at LANSET.COM> Jun 29, 1999
- 602 views
- Last edited Jun 30, 1999
Joe Otto wrote: >If anyone's interested: > > 1) Let me know and I'll post it when it's usable > 2) I'll probably need help writing a demo using it > 3) Feel free to suggest features I may have forgotten I'm interested. -- David Cuny
3. Re: Object Oriented Programming
- Posted by Ralf Nieuwenhuijsen <nieuwen at XS4ALL.NL> Jun 30, 1999
- 592 views
> Joe Otto wrote: > > >If anyone's interested: > > > > 1) Let me know and I'll post it when it's usable > > 2) I'll probably need help writing a demo using it > > 3) Feel free to suggest features I may have forgotten Yep, Joe, lets see the code. Your list sounds pretty interesting and I haven't seen any full-featured OO system, that actually integrated with Eu nicely. Most current systems are either basic and flat (my attemts), which usually do run at a reasonable speed, or full-featured and totally interpreted, which usually run slow. The real issue actually, is how variables are stored and looked up. David uses a pretty readable approach in his Liama, although I couldn't completely figure out how his class-handling works ... (david, where's the docs ?) Anyways, certain 'advantages' of OO are often simulated in Eu, by using routines that 'manage' and 'register' other routines and interfaces, using routine_id. However, the emphasize is on the word 'simulate'. Font-libraries that allow different font-handles (like Jiri's), graphics libraries that allow registration of commands (like Neil), etc. all are simulations of 'advantages' of OO, rather than direct simulations of OO. I'm curious when we're going to close this gap, if there really is a way, with the current scope rules, anyway. Ralf
4. Re: Object Oriented Programming
- Posted by "Bruce M. Axtens" <bruce_axtens at SIL.ORG> Jun 30, 1999
- 603 views
Thus spake David Cuny on Tue, 29 Jun 1999: >Date: Tue, 29 Jun 1999 20:19:24 -0700 >From: David Cuny <dcuny at LANSET.COM> >Subject: Re: Object Oriented Programming > >Joe Otto wrote: > >>If anyone's interested: >> >> 1) Let me know and I'll post it when it's usable >> 2) I'll probably need help writing a demo using it >> 3) Feel free to suggest features I may have forgotten > >I'm interested. And so am I! Might even understand what OOP is about after using it. Bruce.
5. Re: Object Oriented Programming
- Posted by David Cuny <dcuny at LANSET.COM> Jun 30, 1999
- 616 views
Ralf wrote: >The real issue actually, is how variables are stored and looked up. David >uses a pretty readable approach in his Liama, although I couldn't completely >figure out how his class-handling works ... (david, where's the docs ?) You mean that code isn't all self-explanatory? [ general rules ] - Only one class should be declared per file. - The only global declared in a file should be the class id. - All identifiers should end in "_" to ensure they are private. [ declaring classes ] Classes are declared with the statement: global constant <classId> = derivedFrom( <superClassId>, <className> ) If you don't have a class to derive from, use a superclass of 0. For example: global constant BaseClass = deriveFrom( 0, "BaseClass" ) global constant HScrollBar = deriveFrom( ScrollBar, HScrollBar ) A derived class will inherit all the methods and local variables from it's superclass. [ declaring local variables ] Local variables are declared as: constant <local> = local( <classId>, <localName> ) For example: constant handle_ = local( BaseClass, "handle" ) If the local is already part of the class (inherited from a superclass), local() will not allocate extra storage for it. [ using local variables ] Locals can be accessed and updated with: my( <localIndex> ) setMy( <localIndex>, <value> ) incrMy( <localIndex>, <value> ) or my( <localName> ) setMy( <localName>, <value> ) incrMy( <localName>, <value> ) For example: setMy( handle_, hwnd ) foo = my( color_ ) bar = my( "color" ) incrMy( "counter", 1 ) [ assigning class methods ] Class methods are assigned using the syntax: method( <classId>, <methodName>, <routineId> ) For example: method( BaseClass, "new", routine_id("BaseClass_") ) Note that the object is not part of the method parameters (see next section). [ calling methods ] Methods can be called with the syntax: procedures: proc( <object>, <method>, <argList> ) functions: result = func( <object>, <method>, <argList> ) For example: dc = func( self, "getDC", {} ) proc( MyWindow, "setSize", {100, 200 } ) There is a special variable called 'self' that contains the id of the current object. This is set automatically when proc() or func() is invoked. [ creating objects ] The 'new' method has the syntax: <id> = new( <class>, <argList> ) For example: MyWindow = new( Window, { 100, 100, "Window Title" } ) The 'new' method automatically allocates storage for the object. To initialize an object, you will often want to call the 'new' method of it's superclass as well. This is accomplished with the classProc, which behaves the same as proc, but allows you to call the procedure of a specific class (in this case, the superclass): procedure SomeClass_() -- call the superclass's initialization classProc( self, BaseClass, {} ) -- initialize ... etc ... end procedure method( SomeClass, "new", routine_id("SomeClass_") ) [ destroying objects ] The 'destroy' method automaticall triggers the 'destroy' method of all the derived classes. So given the class structure of: Generic --> Control --> PushButton if you called: destroy( MyPushButton ) the method Generic.destroy would run first, then Control.destroy, and then finally PushButton.destroy; once all the methods had run, the space would be deallocated. That's about all there is to it. I'll try to write it up some time, when it stabilizes. Hope this helps! -- David Cuny
6. Re: Object Oriented Programming
- Posted by Michael Nelson <mike-nelson-ODAAT at WORLDNET.ATT.NET> Jun 30, 1999
- 612 views
------=_NextPart_000_0042_01BEC2D5.CC951EE0 charset="iso-8859-1" -----Original Message----- From: Joe Otto <jotto at NETZERO.NET> To: EUPHORIA at LISTSERV.MUOHIO.EDU <EUPHORIA at LISTSERV.MUOHIO.EDU> Date: Tuesday, June 29, 1999 7:57 PM Subject: Object Oriented Programming Joe Otto wrote: >When I first learn a new programming language I usually pick a project to >get accustomed to the syntax, etc. When I started learning Euphoria I >decided to write an OOP library. I'm getting close to completing the alpha >version. It's loosely modeled after the way C++ handles objects. Here's a >preliminary feature list: > > Reasonably straightforward syntax > Virtual methods that can be overloaded by child classes > Inheritance from multiple base classes > Class-wide common variables and constants > Data hiding through the use of Public, Protected, and Private access > Type-checking > User-defined object persistence > Accessed by reference > Passing as arguments to subroutines by reference is implied and automatic > >If anyone's interested: > > 1) Let me know and I'll post it when it's usable > 2) I'll probably need help writing a demo using it > 3) Feel free to suggest features I may have forgotten > I am very interested in this. I am the current version of my own Eclasses.e which is based on the JAVA model of single inheritance with interfaces. Please feel free to mine it for ideas. An area I intentionally deviated from C++/JAVA was to separately specify read and write access for data members--this can allow, for example, pubic read access but private write access. This also allows a special write-access specifier: read-only. A read-only member may be initialized but not thereafter changed. I would love to see Joe's code when available! --Mike Nelson ------=_NextPart_000_0042_01BEC2D5.CC951EE0 name="Eclasses.zip"
7. Re: Object Oriented Programming
- Posted by Joe Otto <jotto at NETZERO.NET> Jul 01, 1999
- 585 views
--Snip I am very interested in this. I am the current version of my own Eclasses.e which is based on the JAVA model of single inheritance with interfaces. Please feel free to mine it for ideas. An area I intentionally deviated from C++/JAVA was to separately specify read and write access for data members--this can allow, for example, pubic read access but private write access. This also allows a special write-access specifier: read-only. A read-only member may be initialized but not thereafter changed. I would love to see Joe's code when available! --Mike Nelson << File: Eclasses.zip >> Thanks for the input. At this point I would have to do major rework on the data structures to support that type of conditional access, but I'll keep it in mind for down the road. More later... Joe ________________________________________________________ NetZero - We believe in a FREE Internet. Shouldn't you? Get your FREE Internet Access and Email at http://www.netzero.net/download/index.html
8. Re: Object Oriented Programming
- Posted by Gary Dumer <dumer9354 at WHITE-MARSH.AIM-SMART.COM> Jul 04, 1999
- 602 views
Robert Craig, This has probably been asked before, but... With all the recent talk on the mailing list about OOP, and the several (4 or 5) independent OOP libraries curently available or under development (and all different), are you ever going to add OOP to the official release of Euphoria? OOP that is part of the core language, not an add on library? >--Snip > >I am very interested in this. I am the current version of my own >Eclasses.e >which >is based on the JAVA model of single inheritance with interfaces. Please >feel free to mine it for ideas. An area I intentionally deviated from >C++/JAVA was to separately specify read and write access for data >members--this can allow, for example, pubic read access but private write >access. This also allows a special write-access specifier: read-only. A >read-only member may be initialized but not thereafter changed. > >I would love to see Joe's code when available! > >--Mike Nelson > << File: Eclasses.zip >> > >Thanks for the input. At this point I would have to do major rework on the >data structures to support that type of conditional access, but I'll keep >it in mind for down the road. More later... > >Joe > >________________________________________________________ >NetZero - We believe in a FREE Internet. Shouldn't you? >Get your FREE Internet Access and Email at >http://www.netzero.net/download/index.html
9. Re: Object Oriented Programming
- Posted by Robert Craig <rds at ATTCANADA.NET> Jul 04, 1999
- 618 views
- Last edited Jul 05, 1999
Gary Dumer writes: > are you ever going to add OOP to the official release > of Euphoria? OOP that is part of the core language, not > an add on library? Maybe someday. It's not very high on my list at the moment. The *concept* of OOP is appealing, but I would hate to follow the slippery slope that turned C into C++. Regards, Rob Craig Rapid Deployment Software http://members.aol.com/FilesEu/
10. Re: Object Oriented Programming
- Posted by Gary Dumer <dumer9354 at WHITE-MARSH.AIM-SMART.COM> Jul 05, 1999
- 684 views
>Gary Dumer writes: >> are you ever going to add OOP to the official release >> of Euphoria? OOP that is part of the core language, not >> an add on library? > >Maybe someday. It's not very high on my list at the moment. >The *concept* of OOP is appealing, but I would hate to follow the >slippery slope that turned C into C++. > Yes... but, sadly, C++ isn't about to do a C-- and revert back to C. I'm afraid we're stuck with it. And, it seems there's a GREAT interest in the members of the mailing list. >Regards, > Rob Craig > Rapid Deployment Software > http://members.aol.com/FilesEu/
11. Re: Object Oriented Programming
- Posted by Irv Mullins <irv at ELLIJAY.COM> Jul 05, 1999
- 619 views
On Mon, 05 Jul 1999, you wrote: > >Gary Dumer writes: > >> are you ever going to add OOP to the official release > >> of Euphoria? OOP that is part of the core language, not > >> an add on library? > > > >Maybe someday. It's not very high on my list at the moment. > >The *concept* of OOP is appealing, but I would hate to follow the > >slippery slope that turned C into C++. > Yes... but, sadly, C++ isn't about to do a C-- and revert back to C. I'm > afraid we're stuck with it. And, it seems there's a GREAT interest in the > members of the mailing list. > We're trying to avoid also get stuck with Euphoria++ :) OOP is great for some things, terrible for others, and like most things, over-hyped. I am unable to see, for example, how objects would be much help in writing my next program - a billing program for a trucking company.* On the other hand, if I were designing a graphics package, I would certainly want to use an oop approach. And please don't make OOP mandatory - my fingers get tired from all that extra typing. *Examples to prove me wrong are welcome. Irv
12. Re: Object Oriented Programming
- Posted by Todd Riggins <triggins at AIRMAIL.NET> Jul 05, 1999
- 588 views
Gary Dumer wrote: > Yes... but, sadly, C++ isn't about to do a C-- and revert back to C. I'm > afraid we're stuck with it. And, it seems there's a GREAT interest in the > members of the mailing list. Yes... but, sadly, your statement doesn't make sense to me, personally. C++ did not 'replace' C. No body on this planet is stuck with OOP. Me being a hardcore 'C' programmer and speaking for other millions of Professional and hobbiest programmers that don't use OOP design, find the above statement rather invalid. I, personally, don't have any interest in OOP design and probably never will. If I put my mind to it, I can program anything I want without OOP design. For you and other people who want to do OOP design in Euphoria can use the add-on libraries that are being developed. Euphoira is exactly what Euphoria ought to be. Meaning, Euphoria is what Rob designed it to be. Rob is the Master of Euphoria. :) If he so chooses to make a 'Euphoria++', then it will be. I personally find Euphoria very pleasing the way it is. I apologize if I sound like I'm ranting,raving or whinning here. But, if I took the above statement that Gary Dumer wrote wrong, please put me in my place! I just had to voice my opinion. ;) - Todd
13. Re: Object Oriented Programming
- Posted by Gary Dumer <dumer9354 at WHITE-MARSH.AIM-SMART.COM> Jul 05, 1999
- 601 views
-----Original Message----- From: Todd Riggins >Gary Dumer wrote: >> Yes... but, sadly, C++ isn't about to do a C-- and revert back to C. I'm >> afraid we're stuck with it. And, it seems there's a GREAT interest in the >> members of the mailing list. > >Yes... but, sadly, your statement doesn't make sense to me, personally. >C++ did not 'replace' C. No body on this planet is stuck with OOP. >Me being a hardcore 'C' programmer and speaking for other millions >of Professional and hobbiest programmers that don't use OOP design, >find the above statement rather invalid. I haven't gotten the memo yet anointing you the world spokesman "for other millions of Professional and hobbiest programmers that don't use OOP design". Lighten up a bit Todd. If you'll look at the above statement again, it's pretty obvious I'm not that great a fan of OOP either. However, I'm willing to live in today's world an experiment with new technologies. > >I, personally, don't have any interest in OOP design and probably >never will. If I put my mind to it, I can program anything I want >without OOP design. For you and other people who want to do OOP design >in Euphoria can use the add-on libraries that are being developed. > >Euphoira is exactly what Euphoria ought to be. Meaning, Euphoria >is what Rob designed it to be. Rob is the Master of Euphoria. :) >If he so chooses to make a 'Euphoria++', then it will be. >I personally find Euphoria very pleasing the way it is. > >I apologize if I sound like I'm ranting,raving or whinning here. >But, if I took the above statement that Gary Dumer wrote wrong, >please put me in my place! I just had to voice my opinion. ;) > Actually, you did take it wrong. Perhaps you should go back and re-read the original message to Rob. It was a simple question as to if and when he may introduce OOP into the core Euphoria, since so many messages about OOP were showing up on the mailing list. I'm not trying to PUSH anything so "heinous" as OOP on anyone. Gary.
14. Re: Object Oriented Programming
- Posted by Todd Riggins <triggins at AIRMAIL.NET> Jul 05, 1999
- 587 views
Gary Dumer wrote: > Actually, you did take it wrong. Perhaps you should go back and re-read the > original message to Rob. It was a simple question as to if and when he may > introduce OOP into the core Euphoria, since so many messages about OOP were > showing up on the mailing list. I'm not trying to PUSH anything so "heinous" > as OOP on anyone. Okay, you right, I apoligize. I pushed me panic button without knowing the history of your subject. Man, do I feel like a total dweeb... that teaches me... - Todd
15. Re: Object Oriented Programming
- Posted by Roderick Jackson <rjackson at CSIWEB.COM> Jul 05, 1999
- 687 views
Just for the record Rob... I've been working on the design of a purely object-oriented language for probably a couple of years now. EVERYTHING, including code and data (even down to individual numbers) would be objects; basically, it borrows heavily from Lisp and Smalltalk. I had gotten most of the design finished when I discovered Euphoria; I was shocked and pleasantly surprised at how similar it was to my own language. My immediate desire for the features was satisfied, although I still hope to complete my project. Quartz, believe it or not, is designed as a scaled-down, ad-hoc "wrapper" to implement key pieces of my language in Euphoria. And it really wasn't that difficult to write. (But considering the similarity between the two languages, the only way I could get any extra benefit from such an approach would be to actually finish fully implementing mine...) My point is this: Euphoria is already halfway there to being an OOP language. With a clear conceptualization and strong foundational philosophy, working OOP into the *design* shouldn't be much of a problem. (I think you'd find you could really take Eu places with an "everything is an object" approach.) Of course, *implementing* it might take a bit of work. As it stands, I wouldn't think things would slow down TOO much if you integrated OOP features on top of the current Euphoria code (but on a lower level than just another Euphoria library.) Just food for thought. Rod Jackson ---------- From: Robert Craig[SMTP:rds at ATTCANADA.NET] Sent: Sunday, July 04, 1999 10:43 PM To: EUPHORIA at LISTSERV.MUOHIO.EDU Subject: Re: Object Oriented Programming Gary Dumer writes: > are you ever going to add OOP to the official release > of Euphoria? OOP that is part of the core language, not > an add on library? Maybe someday. It's not very high on my list at the moment. The *concept* of OOP is appealing, but I would hate to follow the slippery slope that turned C into C++. Regards, Rob Craig Rapid Deployment Software http://members.aol.com/FilesEu/