Einzelnen Beitrag anzeigen

Benutzerbild von Uwe Raabe
Uwe Raabe

Registriert seit: 20. Jan 2006
Ort: Lübbecke
11.024 Beiträge
 
Delphi 12 Athens
 
#32

AW: With und Klassenmethoden

  Alt 16. Aug 2015, 16:57
Uwe, kannst du ein Sourcecode-Analyse-Tool empfehlen? Ich würde den Code gerne diesbezüglich mal überarbeiten.
Ich verwende dazu den Pascal Analyzer.

Der Parser läuft schneller, weil er weniger zu parsen hat.
Um mal auf die ursprüngliche Intention von with und die damaligen Einschränkungen hinzuweisen:

Zitat von Pascal User Manual and Report (1975):
The above notation can be a bit tedious, and the user may wish to abbreviate it using the with statement. The with clause effectively opens the scope containing the field identifiers of the specified record variable, so that the field identifiers may occur as variable identifiers. (Thereby providing an opportunity for the compiler to optimize the qualified statement.)

...

No assignments may be made by the qualified statement to any elements of the record variable list. That is, given:
with r do S
r must not contain any variables subject to change by S.
Vereinfachte Schreibweise war wohl nur ein netter Nebeneffekt. Die Optimierung des Compilers war damals halt viel wichtiger. Und Ändern des Records innerhalb with ging auch nicht.
Uwe Raabe
Certified Delphi Master Developer
Embarcadero MVP
Blog: The Art of Delphi Programming
  Mit Zitat antworten Zitat