Wrapping Python - A function wrapping template

Daniel Keep daniel.keep.lists at gmail.com
Tue Jun 13 14:14:39 PDT 2006



Tom S wrote:
> Daniel Keep wrote:
>> * Do you have any plans on how to wrap the method definition array?  I
>> tried using nested templates but D didn't like it :(
> 
> May I know which part of nested templates it didn't like ?
> 

I deleted the code a while back, but it was basically using these
nested, recursive templates so that I could do this:

alias StartModule!("Quxx").AddMethod!("foo",
PydWrap!(foo)).AddMethod!("bar", PydWrap!(bar)).EndModule!() QuxxModule;

However, D complained of various things.  Funny thing was, THIS worked:

alias StartModule!("Quxx") t1;
alias t1.AddMethod!("foo", PydWrap!(foo)) t2;
alias t2.AddMethod!("bar", PydWrap!(bar)) t3;
alias t3.EndModule!() QuxxModule;

But I figured that was as much, if not more verbose then doing it
"long-hand", so I gave up.

	-- Daniel

P.S.  Like so many things, I can't actually remember specifics of how I
defined that thing, but that was the gist of it.

-- 
Unlike Knuth, I have neither proven or tried the above; it may not even
make sense.

v2sw5+8Yhw5ln4+5pr6OFPma8u6+7Lw4Tm6+7l6+7D
i28a2Xs3MSr2e4/6+7t4TNSMb6HTOp5en5g6RAHCP  http://hackerkey.com/



More information about the Digitalmars-d mailing list