"weak" strong typing...
"weak" strong typing...
I have two types defined:
TOneType = type RawByteString;
TSecodType = type RawByteString;
Is it possible to force strong typing in the method definition:
procedure PassOnlyOneType(const OneType: TOneType);
so that it is not possible to call with a parameter of another type?
var
SecondType: TSecondType;
PassOnlyOneType(SecondType); <--- here I want to have a compilation error, now error not occur
How properly construct new type?
I have two types defined:
TOneType = type RawByteString;
TSecodType = type RawByteString;
Is it possible to force strong typing in the method definition:
procedure PassOnlyOneType(const OneType: TOneType);
so that it is not possible to call with a parameter of another type?
var
SecondType: TSecondType;
PassOnlyOneType(SecondType); <--- here I want to have a compilation error, now error not occur
How properly construct new type?
You know that you can't achieve this with a dynamic string type. So what else have you got? Record is it. And it works fine. I don't understand your objection.
ReplyDeleteDavid Heffernan My objection you see in new thread with record and memory leak ;-)
ReplyDeleteJacek Laskowski Well, I gave you a perfectly good workaround. So that should be case closed. And why are you even using strings anyway. This looks like a byte array.
ReplyDelete