> On 17/03/2013 12:54, Marco van de Voort wrote:
>>
>> Since it is a pseudo variable declaration, I would assume VAR syntax and
>> just use ":" ?

This is indeed better.


On Sun, Mar 17, 2013 at 10:51 AM, Martin <laza...@mfriebe.de> wrote:
> 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.

This is what already happens between the members of "aliased"
variables, and that's IMO reason for the proposal.
So I don't see a problem, on the contrary, it's progress since it
needs a more direct/clearer user "error" to be bitten by it.


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

It would be better.


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

I don't think so.

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

My POV is "with" already implies an undeclared variable.

Regards,
Flávio
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to