On 11/15/2013 10:06 AM, Martin Schreiber wrote:
>
> 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?
>
+1

IMHO there is no decent way to handle the "with ambiguity" in Pascal. 
The Oberon "with alia" looks a lot more obvious.

But IMHO it is better to avoid the "with" keyword altogether and use a 
pointer (in fact in Object Pascal it's possible to hide the fact that it 
is a pointer, by simply using the same "." notation instead of "^".)

thus instead of


var rec1: tr;
...
with r:= rec1 do
  r.field1:= 123
end;
...



going e.g:


var r: tr;
...

var r : ^tr = rec1;         // new syntax: initializing a variable with a 
potentially non-constant value; as the declaration is withing active code.
r.field1:= 123;             // mind: within the "do" block (which now can be 
omitted) we have exactly the same source code
...


In fact such new syntax is rather similar to the Oberon "with" but a lot 
more powerful and not only usable with records.

-Michael

------------------------------------------------------------------------------
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