On Sat, Mar 16, 2013 at 10:14 PM, Xiangrong Fang <xrf...@gmail.com> wrote:
>> >  I don't know what's make it complex if there are 2 or more subject in
>> > the with?
>>
>> Context. A conflict case the two object were of the same class.
>
>
> Are you saying this case:
>
> with MyClassInstance1 as m, MyClassInstance2 do begin
>   m.Property1 := 123;
>   Property2 := 456;
> end;
>
> Here you don't know Property2 belongs to which object instance??

No, he's saying that *his hack* using class helper wouldn't cover this
case (two objects in the same 'with' clause).

Daniel, I find this hack as ingenious as atrocious ;-)
But thinking about it a bit, when FPC gets generic methods you can
make this kind of workable!

> (...)
> To summarize, "as" does NOT try to eliminate context ambiguity (also it
> won't make a clear context ambiguous), but provided some convenience when
> needed.

As Sven said this feature has already been requested a few times.
I don't remember whether it was permanently vetoed by FPC developers
or just is in the to-do, but vaguely remember people arguing it's
"un-pascal" because of the local variable/scope - which is
unfortunate, because IMO the 'with' syntax is one of the most
abominable un-pascal things Borland introduced in the language, and
*forcing* the AS syntax (but probably with some other keyword like
ALIAS) would make it much more palatable.

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

Reply via email to