digitalmars.D.learn - Is this possible?
- Paolo Invernizzi (21/21) Feb 20 2006 Hi all,
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
Feb 20 2006








Paolo Invernizzi <arathorn NOSPAM_fastwebnet.it>