type
TPoint2d = record
x : Double;
y : double;
end;
type
TLine2d = array[0..1] of TPoint2d;
type
TSegment2d = array[0..1] of TPoint2d;
method Orientation(const Line:TLine2D; const Point:TPoint2D):Integer;
method Orientation(const Segment:TSegment2D; const Point:TPoint2D):Integer;
How to tell the compiler that these are different Types?
I got error on compile because of duplicate Type?
But the types are declared as different…
I dont know if Oxygene provides something special about this, but the thing is, whats different is just the name, but the content is the same and the compiler is telling you exactly this, in the form of: in Both aliases you have the exact same array!.
And btw:
you just need 1 type for the types you declare under the word type!
And just Change the name maybe to: OrientByLines and OrientBySegment or something like this…
TArrayType = Array[0..1] of X;
TArrayType2 = Array[0..1] of X;
are different types in Delphi, FreePascal, but not in Oxygene.
I prefer the consistency of Oxygene, TypeA = TypeB is always an alias but
we should be able to use
TypeA = type TypeB
as in Delphi, FreePascal, if we want the types to be different.
And then we should be able to do TArrayType = type Array[0…1] of X;
Agreed. we should add support for type, but the array syntax should stay behaving as it is (an alias), and also require/support type to make them distinct.
type
TDoubleArray = array[1..2] of Double;
TdoubleArray2 = type TDoubleArray;
test = class
public
method Test(Values : TDoubleArray);
begin
if Values[1] <> Values[2] then;
end;
method Test2(Values : TDoubleArray2);
begin
if Values[1] <> Values[2] then;
end;
end;
I get:
Severity Code Description Project File Line Suppression State
Error (E189) Type “TdoubleArray2” has no default property to use for array accessors X:\Elements\Tests\Codefile1.pas 17