1. eg
- Posted by Jason Gade <jaygade at yahoo.com> Dec 09, 2004
- 523 views
- Last edited Dec 10, 2004
Some questions regarding eg -- One, can eudir take a string as input? Two, can eudir be used in an if statement?
if platform() = LINUX then eudir ~/myeuphoria else eudir C:\myeuphoria end if
Three, another enhancement asked for was for object(o) to return zero for unitialized vars. Any plans? Four, your routine_list() and variable_list() functions say they "Return a list of all routines registered with routine_id() or variable_id()". Does that mean you have to have used routine_id() or variable_id() for a variable before it shows up, or will it return a list of all identifiers? What about scope? Thanks. If I had a chance to check it out before next week I would. PS -- it looks like you're 'it' for trying out new stuff... I still want to study the interpreter but I'm still not very good at reading and understanding long programs. j.
2. Re: eg
- Posted by Jason Gade <jaygade at yahoo.com> Dec 09, 2004
- 506 views
- Last edited Dec 10, 2004
Jason Gade wrote: > PS -- it looks like you're 'it' for trying out new stuff... I still want to > study > the interpreter but I'm still not very good at reading and understanding long > programs. I should have put ;^) after that... I think that it's cool that you've been able to modify the interpreter source already. j.
3. Re: eg
- Posted by Greg Haberek <ghaberek at gmail.com> Dec 10, 2004
- 502 views
> One, can eudir take a string as input? Yes, just make sure you use double back-slashes like any other string. "C:\\EUPHORIA" > Two, can eudir be used in an if statement? As of yet, no. But I'm looking into eudir and include working in any level of code, if, for, while, procedure, function, type, etc.. > Three, another enhancement asked for was for object(o) to return zero for > unitialized vars. Any plans? This was actually my suggestion, so yes. I actually forgot about it. It will be in the next release. > Four, your routine_list() and variable_list() functions say they "Return a > list of all routines registered with routine_id() or variable_id()". Does that > mean you have to have used routine_id() or variable_id() for a variable before it > shows up, or will it return a list of all identifiers? What about scope? You must explicitly call, or have called routine_id() or variable_id() at one time. The reason is that the routine id list and variable id list are not the same as the symbol table. routine_id() adds your routine to its internal list and returns the index (starting from 1), and the same for variable_id(). Scope is not affected. You can call variable_id() inside a procedure or in another include file. You just won't be able to read/write the variable once it no longer exists. I am working on a way to determine if a variable_id() is valid or not. > PS -- it looks like you're 'it' for trying out new stuff... I still want to > study the interpreter but I'm still not very good at reading and understanding > long programs. I'm still learning... there's a few things I don't understand about the interpreter yet. I'm sure my variable_id() will cause some issues with variables that are no longer used and such, but I'm getting there. The more features I add, the more easier it gets. And yes, "more easier" is a technical term. :) Truthfully, this all comes out of my own selfishness. I wasn't going to share my new interpreter at first, but I figured why not? Somebody needs to give everyone the features they want! ~Greg
4. Re: eg
- Posted by Matt Lewis <matthewwalkerlewis at yahoo.com> Dec 10, 2004
- 519 views
Jason Gade wrote: > > PS -- it looks like you're 'it' for trying out new stuff... I still want to > study > the interpreter but I'm still not very good at reading and understanding long > programs. > Well, not quite, but he's the first to release anything. I've been working on my object oriented euphoria concept. It seems to be working quite well (although I'm trying to come up with a better keyword than 'class', since that's such a common variable name--any suggestions?). I'm in the process now of allowing saving of the already parsed il code for later execution. Matt Lewis
5. Re: eg
- Posted by cklester <cklester at yahoo.com> Dec 10, 2004
- 508 views
Matt Lewis wrote: > (although I'm trying to come up with a better keyword than 'class', > since that's such a common variable name--any suggestions?). Use 'class' regardless. People will come up with other variable names. :) -=ck "Programming in a state of EUPHORIA." http://www.cklester.com/euphoria/
6. Re: eg
- Posted by Dave Probert <zingo at purpletiger.com> Dec 10, 2004
- 493 views
Matt, will you be attempting to do a version of the Euphoria whereby we can do nice things like: class fred ... etc ifred = new fred ifred.a_method(params) ie. as opposed to things like: call_method( ifred, "a_method",params ) In other words an enhanced OO call structure and "dot" access operator (or suchlike)?? If so then you will be IT (and I really mean it :)) . .. : :: = == == = :: : .. . Server-Side DB driven web sites, Software Development and part-time games developer contact dave_p at purpletiger dot com . .. : :: = == == = :: : .. .
7. Re: eg
- Posted by Jason Gade <jaygade at yahoo.com> Dec 10, 2004
- 511 views
Okay, so I lied. I took about an hour to test out eg. I made a framework that answered my questions above, and it all makes sense. One thing, though, I used a assigned string constant for the eudir directive and I think it worked (need to test some more), but the interpreter warned that the constant wasn't used. Also I tested sanity.ex. I had to create a new copy called sanity.eg because sanity.ex has an identifier called 'eudir' that clashed with your new keyword. Otherwise, everything seemed to work. I liked the idea of embedding ed into the interpreter until I tried using it. Then I remember how much I like using even Microsoft edit better! There must be a better (but still stable) editor... j.
8. Re: eg
- Posted by Bernie Ryan <xotron at bluefrog.com> Dec 10, 2004
- 501 views
Matt Lewis wrote: > well (although I'm trying to come up with a better keyword than 'class', Matt: How about 'Group' or 'Collection' Bernie My files in archive: w32engin.ew mixedlib.e eu_engin.e win32eru.ew Can be downloaded here: http://www.rapideuphoria.com/cgi-bin/asearch.exu?dos=on&win=on&lnx=on&gen=on&keywords=bernie+ryan
9. Re: eg
- Posted by Matt Lewis <matthewwalkerlewis at yahoo.com> Dec 10, 2004
- 503 views
cklester wrote: > > Matt Lewis wrote: > > > (although I'm trying to come up with a better keyword than 'class', > > since that's such a common variable name--any suggestions?). > > Use 'class' regardless. People will come up with other variable names. :) The only problem with this is that things like Win32Lib and the Judith's IDE already use 'class'. It seems like suicide to automatically cross them out (or make people modify them). My current word is 'class_typedef'. BTW, I seem to have 'shrouding' (there's not really any encryption) and binding (with a translated and compiled executable) working. Matt Lewis
10. Re: eg
- Posted by Tommy Carlier <tommy.carlier at telenet.be> Dec 10, 2004
- 510 views
> although I'm trying to come up with a better keyword than 'class', > since that's such a common variable name--any suggestions? Maybe 'type' (with a different syntax than the existing 'type'), or 'kind'? -- The Internet combines the excitement of typing with the reliability of anonymous hearsay. tommy online: http://users.telenet.be/tommycarlier tommy.blog: http://tommycarlier.blogspot.com
11. Re: eg
- Posted by Matt Lewis <matthewwalkerlewis at yahoo.com> Dec 10, 2004
- 503 views
Dave Probert wrote: > > Matt, will you be attempting to do a version of the Euphoria whereby > we can do nice things like: > > class fred > ... etc > > ifred = new fred > ifred.a_method(params) > > ie. as opposed to things like: call_method( ifred, "a_method",params ) > > In other words an enhanced OO call structure and "dot" access > operator (or suchlike)?? > > If so then you will be IT (and I really mean it :)) Yes, that's pretty much exactly what I'm doing. Below is my working specification/documentation (note that things are subject to change). One thing that's not in there is that I'm leaving the backend alone, so I'm outputting RDS compatible IL code. This means that there are two possibilities for running your code with an RDS backend: 1) Someone writes a pre-processor to convert object oriented stuff to RDS compatible code. (Not quite trivial, but should be possible.) 2) RDS allows '2-step' binding like I've asked for here. (Trivial for RDS to do, but probably not probable.) --Class Specification --------------------------------------------- global class_typedef ClassName( ClassDataType x ) function fMethod() end function function fMethod( atom a ) end function procedure pMethod() end procedure end class_typedef ClassName instance instance = SomeValue instance.pMethod( instance.fMethod( instance.fMethod() ) ) --Routine Decoration ---------------------------------------------- All routines in a class get decorated so that proper polymorphism can take place. An '@' will be appended to the routine name, followed by the datatypes of the parameters (o: object, a: atom, i: integer, s: sequence, @ClassName@: instance of some class, !UserDefinedType!: a user defined type). Also each method will have a 'this' parameter of the class' type automatically added. It won't show in the source, but can be used (like in C++). It will show up in any debug reports. The routine signatures will be used to allow for a type of polymorphism based on the arguments supplied. The best match for the routine will be called. Since Euphoria isn't very strict with types, there may be ambiguity as to the actual data types being used. For instance, you might use an object parameter, where methods exist for either an atom or a sequence. Also, since a function can return anything, any parameter that is created as a temp from a function return will be treated as an object. If there are multiple methods that match up equally well, one will be arbitrarily picked, and a warning will be generated. You may receive run time type check errors because of this. You can use routine_id() on methods, but will need to pass the fully decorated routine name: id = routine_id( "method@class@a!my_type!si" ) However, routines in a local class will only be visible from within the file itself, unless the routine itself is declared global, even if other global classes inherit from the class. --Scope ----------------------------------------------- Class methods will have the same scope as their classes. However, inherited routines from local classes will be treated the same as the calling class. --Inheritance ----------------------------------------------- Classes can inherit from one super class (which can in turn inherit from other classes). Methods from super classes will be called if the method isn't overridden. Inheritance is defined by creating the class' datatype as some other class: class_typedef foo( integer f ) ... end class_typedef class_typedef bar( foo b ) ... end class_typedef --Calling a method ------------------------------------------------ Dot notation: object.method() --Casting ------------------------------------------------ In order to cast and use a variable as a class, you can either assign it to a variable that is of the class type, or call it in a method call with the name of the class as the instance, and by adding the variable to be cast as the first parameter: class Something( atom s ) -- ... end class atom a Something x a = 5 x = a x.Method() Something.Method(a) --Construction / Destruction ------------------------------------------------- There is no real concept of this, although you could define a class with constructors that do something (allocate memory, or fill a sequence) as follows: class Something( atom x ) function create() -- ignore the this variable... return allocate(4) end function end class Something s s = Something.create(0) Matt Lewis
12. Re: eg
- Posted by Matt Lewis <matthewwalkerlewis at yahoo.com> Dec 10, 2004
- 510 views
Bernie Ryan wrote: > > Matt Lewis wrote: > > well (although I'm trying to come up with a better keyword than 'class', > > Matt: > How about 'Group' or 'Collection' > Those could work... Matt Lewis
13. Re: eg
- Posted by "Igor Kachan" <kinz at peterlink.ru> Dec 10, 2004
- 498 views
Matt Lewis wrote: [snip] > Well, not quite, but he's the first to release anything. I've been working > on my object oriented euphoria concept. It seems to be working quite > well (although I'm trying to come up with a better keyword than 'class', > since that's such a common variable name--any suggestions?). Try please 'clan' or 'family' or 'stock' or even 'gang' I like 'clan' for short, then 'inheritance' may be more clear thing. That 'class' is absolutelly abstract word in a strongly conctete programming, nothing, same as 'object' is everything. Try to understand and explain "nothing of everything", oop...s Regards, Igor Kachan kinz at peterlink.ru
14. Re: eg
- Posted by "Mike Nelson" <MichaelANelson at worldnet.att.net> Dec 11, 2004
- 523 views
Matt, A wothy project indeed. A couple of suggestions: 1) Don't allow a global class to inherit from a local class. The purpose of local classes is to provide support for the global class(es) in the file--the user of the file should only see the global classes. Should simplify the scope rules. 2) Method overloading is a concrete b*tch for multi-parameter methods. I tried this for Diamond and gave up. Diamond uses overloading based only on the number of parameters. If further overloading is required, the Diamond programmer must provide it in the method. If you want to have parametype type overloading, I would suggest this method resolution order: considering all methods of the class, both defined in the class and inherited search all methods with the proper number of parameters in the order the methods were defined and the first mathching signature is the method called. In the case of an overridden superclass method, the search order is based on the original method, but the method called is the overriding method. This will assure consistent MRO's among a class and it's subclasses. -- Mike Nelson
15. Re: eg
- Posted by Matt Lewis <matthewwalkerlewis at yahoo.com> Dec 11, 2004
- 551 views
- Last edited Dec 12, 2004
Mike Nelson wrote: > > Matt, > > A wothy project indeed. A couple of suggestions: > > 1) Don't allow a global class to inherit from a local class. The purpose of > local classes is to provide support for the global class(es) in the > file--the user of the file should only see the global classes. Should > simplify the scope rules. Probably a good idea. Perhaps for the next version. > 2) Method overloading is a concrete b*tch for multi-parameter methods. I > tried this for Diamond and gave up. Diamond uses overloading based only on > the number of parameters. If further overloading is required, the Diamond > programmer must provide it in the method. If you want to have parametype > type overloading, I would suggest this method resolution order: considering > all methods of the class, both defined in the class and inherited search all > methods with the proper number of parameters in the order the methods were > defined and the first mathching signature is the method called. In the case > of an overridden superclass method, the search order is based on the > original method, but the method called is the overriding method. This will > assure consistent MRO's among a class and it's subclasses. I'm using overloading based on number and type of parameters. Since I'm inside the interpreter front end, I have a little more information about the parameters than Diamond. Here's how it works: 1) Find method in class that matches name and number of parameters 2) Count how many parameter types match exactly (and I know which are class types, and UDTs, too) 3) Pick the best one. 4) If there wasn't an exact match, and there were multiple candidates that could have been a match, then generate a warning. 5) If no methods matched, then check methods of parent class if it exists, or throw a compile time error. Matt Lewis