"with" does not work as expected

Avra
Schreiberling
Avatar
Geschlecht:
Herkunft: Belgrade, Serbia
Alter: 54
Homepage: rs.linkedin.com/in…
Beiträge: 653
Dabei seit: 07 / 2002
Betreff:

"with" does not work as expected

 · 
Gepostet: 09.09.2014 - 14:46 Uhr  ·  #1
Code
  // this compiles:
  with Runtime do
    General.Powerup.Moment.Year := RTCgetYear;
  endwith;

  // this does not compile "Error: var or symbol expected":
  with Runtime.General.Powerup.Moment do
    Year := RTCgetYear;
  endwith;

with is of not much use if 2nd example can not compile. Can this be fixed?
rh
Administrator
Avatar
Geschlecht:
Herkunft: Germany
Alter: 25
Homepage: e-lab.de
Beiträge: 5558
Dabei seit: 03 / 2002
Betreff:

Re: "with" does not work as expected

 · 
Gepostet: 09.09.2014 - 20:17 Uhr  ·  #2
Hello Avra,
delphi doesn't anymore recommend "with" in their latest compilers.
Our AVRco only supports "with" within simple records because it
doesn't work in a nested/recursive manner.

Furthermore contrary to big machines (386 etc) "with" doesn't show
any effort with AVRs and similar in most cases. Take a look onto the
ASM output of AVRco.

I for myself doesn't use any withs in AVR since a long time because
of this reasons/limitations.

Your problem with the Runtime error will be investigated.

rolf
Avra
Schreiberling
Avatar
Geschlecht:
Herkunft: Belgrade, Serbia
Alter: 54
Homepage: rs.linkedin.com/in…
Beiträge: 653
Dabei seit: 07 / 2002
Betreff:

Re: "with" does not work as expected

 · 
Gepostet: 10.09.2014 - 09:29 Uhr  ·  #3
Thanks Rolf,

I rarely use "with", but for assignments to deeply nested record members it is very helpful. I don't need it for anything else. Benefit is not typing savings, because copy/paste solves that. Benefit is the readability. My longest record member in current project has full name length twice as "Runtime.General.Powerup.Moment" from the example, and it is also an array, so when I use assignments to copy from one record member to the other visible editor line is not enough to show full assignment. With 24 assignments one bellow the other readability is completely lost and I have to put much effort when looking at the code, since while I come to the end of the line I almost forget what was at line start.

Avra
Gewählte Zitate für Mehrfachzitierung:   0

Registrierte in diesem Topic

Aktuell kein registrierter in diesem Bereich

Die Statistik zeigt, wer in den letzten 5 Minuten online war. Erneuerung alle 90 Sekunden.
MySQL Queries: 15 · Cache Hits: 14   58   72 · Page-Gen-Time: 0.054501s · Speichernutzung: 2 MB · GZIP: ein · Viewport: SMXL-HiDPI