I think the closed "reference guide: precedence of operators table doesn't list assignment operators" needs another look.
Original Reporter info from Mantis: Akira1364
-
Reporter name:
Original Reporter info from Mantis: Akira1364
- Reporter name:
Description:
Noticed how quickly that got closed, don't think it should have been.
Assignment is an operator whether anyone likes it or not. There's no reason for opinions to have any place in the documentation of a programming language, because a programming language is never anything more than what its compiler accepts.
For example, this is perfectly valid Free Pascal code:
program Test;
{$mode ObjFPC}
{$modeswitch AdvancedRecords}
type
TRec = record
class operator := (constref LHS: TRec): String; inline;
end;
class operator TRec.:=(constref LHS: TRec): String;
begin
{ you can literally do anything you want here! }
Result := 'TRec!';
end;
var S: String;
begin
S := Default(TRec);
WriteLn(S);
end.
If assignment is not an operator, then what exactly is going on here:
https://www.freepascal.org/docs-html/ref/refch15.html
Would seem rather inconsistent, at least!
Steps to reproduce:
Compare the language as implemented to the docs?
Mantis conversion info:
- Mantis ID: 35334
- OS: Windows
- OS Build: 10
- Build: 41846
- Platform: x86_64
- Version: 3.3.1