Re: Another feature request
From: Marco Caspers (*nospam*_at_haxor.vaxor.com)
Date: 12/16/03
- Next message: Anders Isaksson: "Re: Another feature request"
- Previous message: Eric Grange: "Re: Moving from Delphi to C++"
- In reply to: Andrew Rybenkov: "Another feature request"
- Next in thread: Rudy Velthuis (TeamB): "Re: Another feature request"
- Reply: Rudy Velthuis (TeamB): "Re: Another feature request"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 16 Dec 2003 00:36:49 -0700
Andrew Rybenkov wrote:
> Add "TypeOf" compiler (pseudo-)function (like "SizeOf") to use in
> declarations:
>
> var
> n: <sometype>;
>
> ...
>
> var
> m: TypeOf(n);
What's the purpose?
You will have to know the type of <sometype> else you can not do
anything with M,
You woudn't not know how to handle it.
Imagine the bugs.
For example:
Var
n: ^MyRecord;
Function MyFunction: String
Var
m: TypeOf(n);
Begin
m := m + 'This is a string that can not be added to a pointer';
Result := m;
End;
Normally you wouldn't be able to compile it.
With your construct you probably could, and are faced with a bug in
your application that'd only show up at runtime. Just like all the
unsafe typecasting in an other programming language.
This one will be fairly easy to spot if you have the source code where
n is decleared..
If you don't have the source then you're fried and would probably never
find the 'why' of the bug, especially if it's hidden under a heap of
if/then/else constructions that only occurs under difficult to
replicate conditions..
Regards,
Marco.
- Next message: Anders Isaksson: "Re: Another feature request"
- Previous message: Eric Grange: "Re: Moving from Delphi to C++"
- In reply to: Andrew Rybenkov: "Another feature request"
- Next in thread: Rudy Velthuis (TeamB): "Re: Another feature request"
- Reply: Rudy Velthuis (TeamB): "Re: Another feature request"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|