[fpc-pascal] a proposal about "with" syntax

Jürgen Hestermann juergen.hestermann at gmx.de
Mon Mar 18 18:03:12 CET 2013


Am 2013-03-16 07:13, schrieb Xiangrong Fang:
> I would like to do this:
>
> with MyClassInstance as mci, SomethingElse do begin
>   Caption := 'A new caption';
>   for i := 0 to Count - 1 do
> mci[i] := UpperCase(mci[i]);
> end;
>
> That is, to add an optional "as" clause to the with statement so that access array element in a structure is made easier.
>
I fail to see how this would be helpful.
It's just more confusing.
Suddenly there are 2 (or more?) identifiers meaning the same thing.
If I want to avoid typing a long identifer name multiple times
I would simply select it and copy it to the clipboard.
If someone (I myself?) chose a long identifier name I think it was for some reason (readability?).
Foiling this by making the code more obscure is not a good idea IMO.
That's making the code a bit more C'ish (harder to read).
You won't cripple down all variables to one letter names A, B, C only because this is easier to type, won't you?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20130318/b3275c5b/attachment.html>


More information about the fpc-pascal mailing list