[fpc-pascal] Feature proposal: function-based assignment operators
Sven Barth
pascaldragon at googlemail.com
Thu Mar 28 18:37:59 CET 2013
Am 28.03.2013 18:02 schrieb "Benito van der Zander" <benito at benibela.de>:
>>
>>
>> There was already a discussion some time ago whether we should allow
operators like "or=" and such as well and the result was simple: no. I
consider this the same here.
>
>
> But it would be more consistent with +=
Consistency does not necessarily make them desireable.
>
>
>> You can achieve a similar effect through type helpers in 2.7.1 though:
>
> looks cool, but I only have 2.6.2...
Then you'll need to wait until 2.8.0 is released (and no, I don't have an
estimate). And even if we'd implement your proposal you'd need to wait for
the next major version...
>
>
>>
>>
>> type
>> TLongIntHelper = type helper for LongInt
>> procedure Min(aValue: LongInt);
>> end;
>>
>> procedure TLongIntHelper.Min(aValue: LongInt);
>> begin
>> Self := Math.Min(Self, aValue);
>> end;
>
>
> Perhaps that should be defined in the rtl
Some helper could be defined in additional units, but the problem with them
is that only one per type can be active at a time (Delphi compatible). My
plan is to change this though, but for this I first need to define proper
search rules for this...
Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20130328/2aca8b45/attachment.html>
More information about the fpc-pascal
mailing list