Some explanation of jargon, in case it is too Delphi centric, though C#'s similar types have pulled most mainstream:
Variant = variadic type (COM olevariant like)
open array = accepts an array of a certain type, and receives the length as implicit parameter. (some languages also pass a pointer to a stack struct with pointer to element 0 and length to keep it one parameter).
property Pseudo field that abstracts between a "true" field (data member) of a struct or object or a getter/setter pair. Indexed (Array) types exist too.
default property the property accessed if you dereference only the class.
array of const Open array type that accepts all element types and pushes typinfo per parameter. Typesafe(r) variant of C variadic parameters.
bluatigro wrote:i want a python like list type in fb
lst = [ 1 , 2 , .3 , "4" ]
Needs constant/literal "array of variant", and a default property of what I assume is object "lst" that can receive an dynamic array of variant. Either directly or via an open array of variant. CHanging the syntax to lst.items= [1,2,3 ] etc would solve ambiguity.
list.append( "test" )
list.append( 1 )
list.append( 0.5 )
The above can be done by overloading alone;
lst.append( [ "test" , 1 , 0.5 ] )
Multiple types is hard with overloading -> needs array of variant literal or open array variant.
if istype( lst[ 4 ] , string ) then
if istype( lst[ 4 ] , double ) then
if istype( lst[ 4 ] , integer ) then
if istype( lst[ 4 ] , list ) then
While one would instinctively assume this is RTTI, if lst separately stores type (or as part of a variadic type) separately, it would need RTTI.
if istype( lst[ 4 ] , sometype ) then
Arbritary (custom) types are very difficult. This would need RTTI and many things more.