[fpc-devel] Proposal: Enhanced replacement for assignment operators

Martin fpc at mfriebe.de
Fri Aug 6 16:37:15 CEST 2010

  On 06/08/2010 15:23, Alexander Klenin wrote:
> On Sat, Aug 7, 2010 at 01:12, Martin<fpc at mfriebe.de>  wrote:
>>   On 06/08/2010 14:53, Alexander Klenin wrote:
>>> Logical ones are actually less important for me,
>>> but mod= and especially div= are rather useful.
>>> Last time I wished a had div= was just a week ago.
>> I could see that in a language where div was some symbol (like % or :) but
>> with a word?
> What it the difference? I agree that "%" is slightly better notation than "mod",
> but that is totally insignificant, and since we are stuck with "mod",
> I see no reason to change it.
Because mixing/combining a word (identifier) with a symbol, well for me: 
it hurts my eyes.

>> Anyway, couldn't you just go the same way that inc does?
>> procedure div(var op1: Integer; op2: Integer); inline;
>> and then write
>> Div(a, 4);
> 1) No, because div is a keyword.
ok DivAssign, Divide, .....
> 2) Also, the actual use case was for TPoints,
> and I have already overloaded operator div.
> I think that the need to duplicate code and pollute
> namespace with additional "DivAssign" procedure
> did not improve the code readability at all
You don't duplicate code:
procedure Divide(var op1: TPoint; op2: TPoint);
   op1 := op1 div op2; // using your overloaded operator.

More information about the fpc-devel mailing list