Mark, Is it possible to allow for cyclic generics? This would really help with chaining method calls with a factory/builder pattern.
Class Entity<T>
Method One:T()
Print "One"
Return Self
End
End
Class Enemy Extends Entity<Enemy>
' Method One:Enemy() is inherited
Method Two:Enemy()
Print "Two"
Return Self
End
End
Class Player Extends Entity<Player>
' Method One:Player() is inherited
Method Three:Player()
Print "Three"
Return Self
End
End Then we could do something like:
New Enemy().One().Two()
New Player().One().Three() Rather than the current ugly way:
Enemy(New Enemy().One()).Two()
Player(New Player().One()).Three() Usually, One would have to return the base class, which means we would need a cast to continue using the methods in the subclasses.
|