Monkey
Store
Community
Apps
Contact
Login or Signup

Generic Interfaces and Bounding

Monkey Programming Forums/Monkey Programming/Generic Interfaces and Bounding

Samah(Posted 1+ years ago) #1
How hard is it to add generic support to interfaces?
Example:
Interface Foo<T>
  Method Bar:Void(arg:T)
End

Class StringTest Implements Foo<StringObject>
  Method Bar:Void(arg:StringObject)
  End
End


Also, is it possible to add bounding?
Example:
Class Foo
End

Class Bar Extends Foo
End

Class Test<T Extends Foo>
  Method SomeMethod:Void(arg:T)
  End
End

New Test<Bar> ' this compiles
New Test<Foo> ' this compiles
New Test<StringObject> ' this doesn't compile