ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> cpp-sig
cpp-sig
Re: [C++-sig] Two Pyste suggestions
by Nicodemus other posts by this author
Sep 29 2003 9:08PM messages near this date
[C++-sig] Two Pyste suggestions | Re: [C++-sig] Two Pyste suggestions
Hi Niall,

Niall Douglas wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Yeah, more ideas!
> 
> The first is a bit radical. I've organised the policies for my 
> project into a python package called "Policies". Within it is a .py 
> file for every class in my library and within each of those is an 
> apply() method.
> 
> In the pyste files, each class imports its policy from 
> Policies.<classname> and calls Policies.<classname>.apply(). This in 
> turn imports the policy .py files for each of the base classes the 
> class inherits from and calls their apply() methods first before 
> setting its own policies for its own local class. Thus you see a 
> change to a base class automatically propagates through the policy 
> hierarchy.
> 
> Now my suggestion is that since pyste knows what classes any class 
> inherits, it could spit out the import's and apply()'s for each 
> policy for class. It would save some work (I've already done it 
> manually, wish I'd thought of it sooner).
> 

Unfortunately, Pyste at that point (while executing the Pyste files) 
doesn't know anything about the bases. For that matter, it doesn't know 
any details about the class. The header file will be parsed only later, 
when the code is about to be generated. To implement something that 
would allow you to do what you want, all the class information should be 
avaiable as you execute the Pyste file, ie, a Class(...) would return an 
object with the methods, bases, etc, of the C++ class, which doesn't 
happen right now. But I plan to make a change like that in the future, 
so we can think about how to integrate a facility that would make it 
easy to do stuff like you want.

> The second suggestion was as I made last time, a --files parameter to 
> specify a file from which to read the list of pyste files as Win2k 
> has a 2Kb limit. I've attached the pyste.py file for an example.
> 

Sure thing, it's in my TODO list. It should be ready tomorrow, with some 
updated documentation (at last!).

Thanks for the feedback!

Regards,
Nicodemus.



_______________________________________________
C++-sig mailing list
C++-sig@[...].org
http://mail.python.org/mailman/listinfo/c++-sig
Thread:
Niall Douglas
Nicodemus
Nicodemus

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved