bcc
bcc copied to clipboard
[Generics] EachIn type conversion
Good day,
Would it be possible for EachIn to be able to convert objects from generics types when possible such as the code below?
Framework BRL.Blitz
Import BRL.Collections
Import BRL.StandardIO
Import BRL.LinkedList
Type TFoo
Field name:String = "foo"
EndType
Type TBar Extends TFoo
Method New()
name = "bar"
EndMethod
EndType
Local gl:TLinkedList<TFoo> = New TLinkedList<TFoo>()
gl.AddLast(New TFoo())
gl.AddLast(New TBar())
'WORKS
For Local f:TFoo = EachIn gl
Print f.name
Next
'DOES NOT WORK
'For Local f:TBar = EachIn list
' Print f.name
'Next
Local l:TList = CreateList()
l.AddLast(New TFoo())
l.AddLast(New TBar())
'WORKS
For Local f:TFoo = EachIn l
Print f.name
Next
'WORKS
For Local f:TBar = EachIn l
Print f.name
Next
Thanks!