[fpc-devel] New language idea: Unified types (assignment size-compatible types).
Mark Morgan Lloyd
markMLl.fpc-devel at telemetry.co.uk
Wed Jun 22 13:19:08 CEST 2011
Paul Dunn wrote:
> On Sun, Jun 19, 2011 at 1:15 AM, Skybuck Flying <skybuck2000 at hotmail.com> wrote:
>
>> Here is a new language idea which would make Delphi a bit more friendly:
>
> Do the Embarcadero developers read this list?
>
>> First the problem:
>>
>> pointers and longwords are not assignment compatible.
>>
>> This is pretty much bullshit because they are the same size.
>
> Unfortunately pointers are not the same size as longwords on some
> architectures - on x64, they're twice the size.
The size is irrelevant. Pointers and numeric types have different sets
of applicable operators, in the same way as bitsets and numeric types
have different operators. You can add two numbers and get a meaningful
result, you can't add two pointers or bitsets.
There's a fairly old book on linkers and loaders which uses the analogy
that pointers are like vectors and integer types like scalars, and then
explores the various combinations of operators etc.
Whether it would be desirable to have some construct that allowed
assignment without a warning is, of course, a different matter. But at
that point, in the general case, one has to consider that different
architectures assume different pointer behavior, such as the normalised
pointers assumed by Turbo Pascal- with which FPC still has some interest
in being compatible.
--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk
[Opinions above are the author's, not those of his employers or colleagues]
More information about the fpc-devel
mailing list