February 20, 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