Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#260 Dynamic variable declaration with RTTI

open
nobody
None
2012-10-25
2012-10-25
John Wright
No

It would be convenient to be able to declare a variable as a certain datatype based on the type that is passed to a procedure as so:

type foo extends object
as integer a = 123
end type

type bar extends foo
as integer a = 456
end type

sub go (n as foo)
dim as typeof(n) x
print x.a
end sub

go(foo) 'prints "123"
go(bar) 'should print "456"

Discussion