Benny Zilberstein <[EMAIL PROTECTED]> writes:

>  
> 
> How hard will it be to add a __eq__ method to the generated
> classes, one that will just compare all the members (also the value of the
> class, if it exists) and return true/false accordingly?
> 

Benny -

This sounds like a very interesting idea.

I'd like to try to make it more general.  There are lots of other __xxx__
methods that might also be usable.

generateDS.py already has a facility for reading method bodies from a file for
special validation methods.  See the notes on "simpleType and validators" in the
documentation (http://www.rexx.com/~dkuhlman/generateDS.html).

What if we were to generalize that still further so that you could provide an
external file containing a list or dictionary of the following triples:
(1) one or more element/class names (or possibly a pattern), (2) a method
header, and (3) an implementation body?

Give me a day or two to think this through and present you with a proposal.

I suspect that I will have a few questions, for example:

1. How would you specify that a method should be generated for a set of classes
or for all classes?  With a wildcard characters or a regex (regular expression)?

2. How would we parameterize it?  Do we need some way to do string replacements
 into the body of the method?

3. Does your __eq__ method need to know (the names of) all the member variables
and perhaps their types?  Perhaps generateDS.py could generate a class variable
containing this information.  I'm not sure.  Need to check.

As you can tell, I'm groping here.  Give me a bit more time to think on it.

Dave



-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
generateds-users mailing list
generateds-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/generateds-users

Reply via email to