Re: Euphoria Object Oriented Programming
- Posted by Pete Lomax <petelomax at blueyonder.co.uk> Jan 04, 2007
- 1099 views
CChris wrote: > Why? > Please explain the issue. > Please read my post on this, from yesterday. I did. It was one of the more jargon-filled posts in this thread. > Matt wrote a few posts about it this month as he was replying to Tapani. > Could you comment on his posted code examples, I have no real problem with that, then again as Matt implied, it was not really a great example. Personally I'd prefer multiple constructors to be replaced with optional parameters, eg:
procedure new(object s1, integer s2=0, s3=0, s4=0) if sequence(s1) then s4=s1[4] s3=s1[3] s2=s1[2] s1=s1[1] end if ... end procedure
so new({1,2,3,4}) and new(1,2,3,4) work the same and avoid any code duplication whatsoever. I agree with and like the fact there is no destructor in ooeu. Putting a * for pass by reference needs some thought. If you are going to have an implicit "this", why not just always pass it by reference? > instead of this unargumented ranting? As I admitted then and will for this post too. > If x has type Myclass, it looks to me completely straightforward that > "x=new(blah)" invokes Myclass.new(blah) to create an instance of Myclass > and bind it to the identifier "x". Matt said there was no real distinction in Eu since we have automatic memory management, which is fine by me. I suspect your use of "bind" there is a bit of C++-speak that we really should avoid in Eu-speak as of course bind has a rather different meaning! Regards, Pete