> ok i see.
>
> Another idea which comes to my mind:
> What about beeing able to specify multiple types for a parameter?
As you shown, multiple types require some kind of discriminating matching.
I would prefer extend the enum's so they can take parameters :
enum AnyNumber {
int( Int );
float( Float );
}
function plusOne( x : AnyNumber ) : AnyNumber {
switch x {
int(i) => int(i + 1);
float(f) => float(f + 1);
}
}
This is not "true" pattern matching yet since there is no recursivity but it
might be already a nice this way to acheive some dynamic typing and
polymorphism in a safe-manner.
Nicolas
_______________________________________________
osflash mailing list
[email protected]
http://osflash.org/mailman/listinfo/osflash_osflash.org