Is this possible?
Paolo Invernizzi
arathorn at NOSPAM_fastwebnet.it
Mon Feb 20 04:09:45 PST 2006
Hi all,
Is it possible in D to use templates or mixins for something like this
(in python)?
def A(par1,par2):
return NO_ERROR
def B(par1):
return ERROR
def wrap(func):
def wrapped(*args):
result = func(*args)
if result == ERROR:
raise Exception('some description')
return wrapped
wrappedA = wrap(A)
wrappedB = wrap(B)
wrappedA( 1,2 )
wrappedB( 3 )
-->> exception raised!
Thanks in advance!
---
Paolo Invernizzi
More information about the Digitalmars-d-learn
mailing list