Re: [fpc-devel] vtCardinal in TVarRec

2019-09-29 Thread Jonas Maebe

On 2019-09-29 11:31, Kirinn wrote:

I'd like to ask for some clarification on this issue:

https://bugs.freepascal.org/view.php?id=32135

Dwords can't be passed into an array of const, because TVarRec doesn't
have an unsigned 32-bit integer type. Adding any kind of handling for
it would be Delphi-incompatible. But isn't the point of the ObjPas
mode to be able to fix regrettable oversights that Delphi has? Can't a
special case be added for accepting Dwords in ObjPas mode only?


That is generally only possible if such a change is confined to the unit 
compiled in (Obj)FPC mode. Otherwise the interoperability between code 
written in different modes –which can be several layers deep, of which 
you as "top level" user may have no idea– becomes a matter of luck (or 
being extremely careful and having the source code of everything 
available, or at least information about the mode the code was written 
in).



Note,
that vtQWord and vtUnicodeString are already extensions going beyond
Delphi. Why not Dword?


FPC supported an unsigned 64 bit integer type before Delphi did, so at 
the time vtQWord was added, there was no Delphi behaviour to be 
compatible with. When Delphi later introduced an unsigned 64 bit integer 
type but no vtQWord, the choice was between breaking backward 
compatibility with existing FPC code or keeping an incompatibility with 
Delphi. In such no-win situations, we generally opt for keeping FPC 
compatibility.


And at least current versions of Delphi also support vtUnicodeString.


Jonas
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


[fpc-devel] vtCardinal in TVarRec

2019-09-29 Thread Kirinn

I'd like to ask for some clarification on this issue:

https://bugs.freepascal.org/view.php?id=32135

Dwords can't be passed into an array of const, because TVarRec doesn't 
have an unsigned 32-bit integer type. Adding any kind of handling for it 
would be Delphi-incompatible. But isn't the point of the ObjPas mode to 
be able to fix regrettable oversights that Delphi has? Can't a special 
case be added for accepting Dwords in ObjPas mode only? Note, that 
vtQWord and vtUnicodeString are already extensions going beyond Delphi. 
Why not Dword?


The reason I ask is that arrays of const are very powerful, and work 
beautifully, except for lacking support for one of the most common 
variable types. And because an array of const is a compiler-level 
construct, I can't even override it. This feels frustrating. :(


~Kirinn

___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel