On 17/03/2013 12:54, Marco van de Voort wrote:
In our previous episode, Sven Barth said:
Now THAT is really unpascalish... either ":=" or the already suggested
"as"...
Since it is a pseudo variable declaration, I would assume VAR syntax and
just use ":" ?


Or maybe it should require a "variable" declaration (or otherwise declared identifier with fixed type).

Otherwise it goes into an undesirable direction:

Function Foo;
begin
  with a: SomeInteger do Work(a);
  with a: SomeBoolean do Work(a);
end;

a is first integer, then boolean within the same scope. *Very* confusing.

And very close to the next step (which of course can be rejected by the compiler)

Function Foo;
begin
  with a: SomeInteger do begin
     Work(a);
     with a: SomeBoolean do Work(a); // masking a
  end;
end;

But if the inner a was Integer too, then maybe it should work? Unless it gets a similar special status like a loop variable?

-------------------
IIRC in other threads on this topic, some people explicitly stated they wanted this feature so the would not need to declare "a" first (I may remember this wrong). IMHO starting with the first loop hole of allowing an undeclared identifier to be used, is just opening the door to more and more weakening of the language requirement.
Besides, it does not hurt, if "a" needs to be declared.



_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to