[fpc-pascal] a proposal about "with" syntax
Paul Ishenin
paul.ishenin at gmail.com
Sun Mar 17 15:07:51 CET 2013
17.03.13, 20:16, Sven Barth пишет:
> But we aren't in a constant or type section here. Also one uses ":=" in
> the for-loop header.
I agree that ':=' should be used but I would not say that '=' is not
pascalish :)
Let's look look at possibilities:
1. 'as' can't be used because we can use expressions in with and we can
'as' typecasting.
2. '=' can't be used because we can use expressions and '=' can be a
part of expression. For example 'with DoSomething(a = b) do'.
3. ':=' can be used since we can't use assignments in with expressions.
4. ':' (Marco suggesion) can be used - it is not used in expressions.
':' is used in pascal to:
- separate variable and type,
- in write intristic
- in record constants to separate field and value
5. We can use some new keyword or reuse some keyword which is not used
in expressions.
If I need to choose from 3, 4 and 5 I would use ':=' syntax because it
more like to assignment:
with a := TStringList.Create do
begin
Text := 'bla';
DoSomething(a);
Free;
end;
Best regards,
Paul Ishenin
More information about the fpc-pascal
mailing list