Hallo Martin,

Du schriebst am Fri, 15 Nov 2013 10:06:53 +0100:

> How do you suggest one should solve the Pascal "with" problem that it is 
> possible that an additional field in the "with" record can hide already
> used names in existing "with" statements with that record?

Why bother? Who's responsible for the workings of the software written in
some programming language - the compiler (writer) or the programmer?
In _this_ case, the compiler has no chance of second guessing the
programmer, so the programmer _has to_ take on the responsibility.
If he doesn't feel sure enough to cope with the complexity, he can simply
avoid using a(nother) "with" statemant at this spot.
I routinely close "with" blocks in cases where I suspect name clashes with
other variables, maybe to open up another record by a subsequent "with".
Shuffling values between records provides a lot of opportunities to use
"with" blocks to one's advantage, but also lots of opportunities for name
clashes to show up. Within a Pascal-style "with", you _cannot_ have equal
level access to two equal names, as is thecase everywhere else just as
well. So you need to use qualification in these cases, and this is
possible for any name you want to use - even for the records opend up in
the current "with" block themselves or the (unit) globals. No need to
declare some nickname for a variable - just use its _real_ name to qualify:

UNIT something;

TYPE
  fail = RECORD
           ...
           clash: ...;
           ...
         END;
VAR
  clash: ...;
  problem: fail;

BEGIN
  ...
  WITH problem DO BEGIN
    ...
    clash:= ... { accesses problem clash }
    problem.clash:= ... { does the same }
    something.clash:= ... { accesses "global" clash }
    ...
  END;

_Where_ is the _problem_? ;-)

-- 
-- 
(Weitergabe von Adressdaten, Telefonnummern u.ä. ohne Zustimmung
nicht gestattet, ebenso Zusendung von Werbung oder ähnlichem)
-----------------------------------------------------------
Mit freundlichen Grüßen, S. Schicktanz
-----------------------------------------------------------



------------------------------------------------------------------------------
DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps
OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
Free app hosting. Or install the open source package on any LAMP server.
Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk
_______________________________________________
mseide-msegui-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk

Reply via email to