|
RAD Studio (Common)
|
Here is a list of standard function changes to support parameterized types. Example forms:
Instantiated type : TFoo<Integer,String>
Open constructed type : TFoo<Integer,T>
Parameterized type : TFoo<,>
procedure Initialize(var X); [.Net]
Instantiated type : allowed
Open constructed type : allowed => Not yet implemented.
Parameterized type : NOT allowed
function High(X:TypeId): Integer|Int64|UInt64;
function Low(X:TypeId): Integer|Int64|UInt64;
Instantiated type : allowed
Open constructed type : allowed => Not yet implemented.
Parameterized type : NOT allowed
function Default(X:TYPE_ID): valueOfTypeId>;
Instantiated type : allowed
Open constructed type : allowed => Not yet implemented.
Parameterized type : NOT allowed
function New;
// a := New(array[2,3] of Integer); [.Net]
// a := New(array[,], (const array init expr)); [.Net]
// a := New(dynArrayTypeId, dim1 [, dim2...dimN]); [.Net]
Instantiated type : allowed
Open constructed type : allowed => Not yet implemented.
Parameterized type : NOT allowed
function SizeOf(TYPE_ID): PosInt;
Instantiated type : allowed
Open constructed type : allowed
Parameterized type : NOT allowed
function TypeInfo;
function TypeHandle;
function TypeId;
// function TypeHandle(Identifier): System.RuntimeTypeHandle; [.Net]
// function TypeInfo(Identifier): System.Type; [.Net]
// function TypeOf(Identifier): System.Type; [.Net]
Instantiated type : allowed
Open constructed type : allowed => Not yet implemented
Parameterized type : NOT allowedThese changes are in support of generics or parameterized types.
{ Type Declarations }
TypeDeclaration -> [ CAttrs ] Ident '=' Type
-> [ CAttrs ] Ident '=' RecordTypeDecl
-> [ CAttrs ] Ident '=' ClassTypeDecl
-> [ CAttrs ] Ident '=' InterfaceTypeDecl
-> [ CAttrs ] Ident '=' ClassHelperTypeDecl
-> [ CAttrs ] Ident '=' RecordHelperTypeDecl
-> [ CAttrs ] Ident '=' TYPE TypeId
-> [ CAttrs ] Ident '=' TYPE ClassTypeId {.Net only}
{NEW} -> [ CAttrs ] Ident TypeParams '=' RecordTypeDecl
{NEW} -> [ CAttrs ] Ident TypeParams '=' ClassTypeDecl
{NEW} -> [ CAttrs ] Ident TypeParams '=' InterfaceTypeDecl
{NEW} -> [ CAttrs ] Ident TypeParams '=' Type
{NEW} TypeParams -> '<' TypeParamDeclList '>'
{NEW} TypeParamDeclList -> TypeParamDecl/';'...
{NEW} TypeParamDecl -> TypeParamList [ ':' ConstraintList ]
{NEW} TypeParamList -> ( [ CAttrs ] [ '+' | '-' [ CAttrs ] ] Ident )/','...
{NEW} ConstraintList -> Constraint/','...
{NEW} Constraint -> CONSTRUCTOR
{NEW} -> RECORD
{NEW} -> CLASS
{NEW} -> TypeId
MethodResolutionClause -> FUNCTION InterfaceIdent '.'
{OLD} Ident '=' Ident ';'
{NEW} Ident [ TypeArgs ] '=' Ident [ TypeArgs ] ';'
-> PROCEDURE InterfaceIdent '.'
{OLD} Ident '=' Ident ';'
{NEW} Ident [ TypeArgs ] '=' Ident [ TypeArgs ] ';'
FunctionHeading -> [ CLASS ] FUNCTION Ident
{NEW} [ FormalTypeParamList ]
[ FormalParameterList ] ':' TypeIdStringFile
ProcedureHeading -> [ CALSS ] PROCEDURE Ident
{NEW} [ FormalTypeParamList ]
[ FormalParameterList ]
ClassOperatorHeading -> CLASS OPERATOR OperatorIdent
{NEW} [ FormalTypeParamList ]
FormalParameterList : TypeIdStringFile
ConstructorHeading -> CONSTRUCTOR Ident
{NEW} [ FormalTypeParamList ]
[ FormalParameterList ]
RecordConstructorHeading -> CONSTRUCTOR Ident
{NEW} [ FormalTypeParamList ]
FormalParameterList
DestructorHeading -> DESTRUCTOR Ident
{NEW} [ FormalTypeParamList ]
[ FormalParameterList ]
MethodBodyHeading -> [ CLASS ] FUNCTION NSTypeId '.' Ident
{NEW} [ FormalTypeParamList ]
[ FormalParameterList ] ':' TypeIdStringFile
-> [ CLASS ] PROCEDURE NSTypeId '.' Ident
{NEW} [ FormalTypeParamList ]
[ FormalParameterList ]
ProcedureTypeHeading -> PROCEDURE
{NEW} [ FormalTypeParamList ]
[ FormalParameterList ]
FunctionTypeHeading -> FUNCTION
{NEW} [ FormalTypeParamList ]
[ FormalParameterList ] ':' TypeIdStringFile
FormalTypeParamList -> '<' TypeParamDeclList >'
{ Types }
Type -> TypeId
-> SimpleType
-> StructualType
-> PointerType
-> StringType
-> ProcedureType
-> ClassRefType
-> TypeRefType
{NEW}-> ClassTypeId TypeArgs
{NEW}-> RecordTypeId TypeArgs
{NEW}-> InterfaceIdent TypeArgs
{NEW} TypeArgs -> '<' ( TypeId | STRING )/','... '>'
{ Attributes }
CAttrExpr -> ConstExpr
-> TYPEOF '(' TypeId ')'
{NEW} -> TYPEOF '(' TypeId '<' [ ','... ] '>' ')'
{NEW} -> TYPEOF '(' TypeId '<' TypeId/','... '>' ')'|
Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
|
|
What do you think about this topic? Send feedback!
|