[fpc-pascal] Why this code fails

Jonas Maebe jonas.maebe at elis.ugent.be
Wed Jan 17 12:56:37 CET 2007


On 17 jan 2007, at 12:28, Alexander Todorov wrote:

> On 16 jan 2007, at 15:55, Matt Emson wrote:
>>
>> >> The reason is that it tries to convert S to a number rather  
>> than V to
>> >> a string. The error is still in the current 2.1.1.
>
> May be the compiler should generate compile time error or a warning.

The whole point of variants is that it allows you to get around  
compile time type checking. If you want compile time type checking,  
don't use variants. Giving a warning for each "non-variant + variant"  
operation which might fail would give a warning for pretty much every  
such operation, since there are virtually always combinations which  
may not give a valid result.


Jonas





More information about the fpc-pascal mailing list