Al 18/03/13 04:11, En/na Paul Ishenin ha escrit:
> '=' can't be used because it can be a part of expression. There is no
> big difference between
> with (a = SomeObject) do
> and
> with a = SomeObject do
But since "with" is only for records/objects/classes there's no possible
confusion (the resul
On 3/18/13, Jürgen Hestermann wrote:
> You won't cripple down all variables to one letter names A, B, C only
> because this is easier to type, won't you?
You would if you'ld be programming in MUMPS ;-)
Bart
___
fpc-pascal maillist - fpc-pascal@lists
At 10:03 AM 3/18/2013, Jürgen Hestermann wrote:
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 optiona
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
a
Am 18.03.2013 15:24, schrieb Flávio Etrusco:
On Mon, Mar 18, 2013 at 10:42 AM, Sven Barth
wrote:
Am 18.03.2013 10:36 schrieb "Xiangrong Fang" :
(...)
I cannot recall if there is already a notion of "alias" in free pascal, if
not then we just introduce this idea within the scope of "with" expre
On Mon, Mar 18, 2013 at 10:42 AM, Sven Barth
wrote:
> Am 18.03.2013 10:36 schrieb "Xiangrong Fang" :
> (...)
>> I cannot recall if there is already a notion of "alias" in free pascal, if
>> not then we just introduce this idea within the scope of "with" expression.
>
> Which is why I suggested "ab
Am 18.03.2013 10:36 schrieb "Xiangrong Fang" :
>
> 2013/3/18 Marco van de Voort
>>
>> In our previous episode, Xiangrong Fang said:
>> > > In our previous episode, Xiangrong Fang said:
>> > > > Alternatively, how about just use SPACE to separate the token?
i.e.:
>> > > >
>> > > > with SomeObject o
On Mon, 18 Mar 2013 15:36:13 +0800
Xiangrong Fang wrote:
> Alternatively, how about just use SPACE to separate the token? i.e.:
>
> with SomeObject o1, SomeOtherObject o2 do
I think this is a bad idea.
One of the strengths of Pascal is its verbosity/redundancy which allows
unambiguous error
2013/3/18 Marco van de Voort
> In our previous episode, Xiangrong Fang said:
> > > In our previous episode, Xiangrong Fang said:
> > > > Alternatively, how about just use SPACE to separate the token? i.e.:
> > > >
> > > > with SomeObject o1, SomeOtherObject o2 do
> > >
> > > That's perfectly
In our previous episode, Xiangrong Fang said:
> > In our previous episode, Xiangrong Fang said:
> > > Alternatively, how about just use SPACE to separate the token? i.e.:
> > >
> > > with SomeObject o1, SomeOtherObject o2 do
> >
> > That's perfectly fine for C. But this isn't C.
>
> What's wro
2013/3/18 Marco van de Voort
> In our previous episode, Xiangrong Fang said:
> > Alternatively, how about just use SPACE to separate the token? i.e.:
> >
> > with SomeObject o1, SomeOtherObject o2 do
>
> That's perfectly fine for C. But this isn't C.
>
What's wrong here? In pascal, we also s
In our previous episode, Xiangrong Fang said:
> Alternatively, how about just use SPACE to separate the token? i.e.:
>
> with SomeObject o1, SomeOtherObject o2 do
That's perfectly fine for C. But this isn't C.
___
fpc-pascal maillist - fpc-pascal@
Alternatively, how about just use SPACE to separate the token? i.e.:
with SomeObject o1, SomeOtherObject o2 do
Because you need a COMMA for 2 or more expressions in with, and SPACE is
not valid in token?
2013/3/18 Sven Barth
> Am 18.03.2013 04:17 schrieb "Xiangrong Fang" :
>
> >
> > OK, I
18.03.13, 11:16, Xiangrong Fang пишет:
OK, I see. However I feel "=>" a very "un-pascal" thing, remind me of
PHP. :-) I guess "as" would also complicate the parser?
I did not suggest to use '=>' I wrote:
> Where '=>' is some token which can't be used in expressions.
Which means replace '=>
Am 18.03.2013 04:17 schrieb "Xiangrong Fang" :
>
> OK, I see. However I feel "=>" a very "un-pascal" thing, remind me of
PHP. :-) I guess "as" would also complicate the parser?
As already written by others: "as" is one of the worst tokens you can
choose for this, as it is perfectly legal to do
OK, I see. However I feel "=>" a very "un-pascal" thing, remind me of PHP.
:-) I guess "as" would also complicate the parser?
2013/3/18 Paul Ishenin
> 18.03.13, 9:27, Xiangrong Fang пишет:
>
> I am sorry I didn't follow this thread although I am the "OP" :-). If
>> I understand correct, I w
18.03.13, 9:27, Xiangrong Fang пишет:
I am sorry I didn't follow this thread although I am the "OP" :-). If
I understand correct, I would suggest NOT introduce the "absolute"
keyword, instead, make it ALWAYS absolute. i.e.:
with a = SomeObject, b = SomeRecord do begin
... ...
end;
Both a a
I am sorry I didn't follow this thread although I am the "OP" :-). If I
understand correct, I would suggest NOT introduce the "absolute" keyword,
instead, make it ALWAYS absolute. i.e.:
with a = SomeObject, b = SomeRecord do begin
... ...
end;
Both a and b are "reference" to the object or rec
On Sun, Mar 17, 2013 at 2:10 PM, Sven Barth wrote:
> On 17.03.2013 15:33, Flávio Etrusco wrote:
>>
>> (...)
>> static int IndexOf(List p_list, T p_item);
>
>
> So you're basically just talking about generic methods here?
Yes. Or actually not, it also involves allowing
non-specialized/not-complet
On 17.03.2013 15:29, Jonas Maebe wrote:
On 17 Mar 2013, at 15:02, Luca Olivetti wrote:
Al 17/03/13 13:54, En/na Marco van de Voort ha escrit:
In our previous episode, Sven Barth said:
Texas Instruments' Pascal had an extension of the with statement, IIRC
it used = instead of AS
With a=Very
On 17.03.2013 15:07, Paul Ishenin wrote:
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;
Yes, I would prefer the ":=" as well because it's basically an
assi
On 17.03.2013 15:33, Flávio Etrusco wrote:
On Sun, Mar 17, 2013 at 6:59 AM, Sven Barth wrote:
On 17.03.2013 06:00, Flávio Etrusco wrote:
type generic TAlias1 = class(TObject)
function Alias1: T;
end;
This already works.
In 2.7 I assume, because it doesn't work in 2.6.2. Grea
Marco van de Voort wrote:
In our previous episode, Sven Barth said:
Texas Instruments' Pascal had an extension of the with statement, IIRC
it used = instead of AS
With a=VeryLongNameForARecord, b=AnotherRecordWithAVeryLongName do ...
Now THAT is really unpascalish... either ":=" or the already
On Sun, Mar 17, 2013 at 6:59 AM, Sven Barth wrote:
> On 17.03.2013 06:00, Flávio Etrusco wrote:
>>
>>type generic TAlias1 = class(TObject)
>> function Alias1: T;
>>end;
>
> This already works.
In 2.7 I assume, because it doesn't work in 2.6.2. Great anyway :)
>> function Alias1(So
On 17 Mar 2013, at 15:02, Luca Olivetti wrote:
> Al 17/03/13 13:54, En/na Marco van de Voort ha escrit:
>> In our previous episode, Sven Barth said:
Texas Instruments' Pascal had an extension of the with statement, IIRC
it used = instead of AS
With a=VeryLongNameForARec
> 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 wrote:
> Or maybe it should require a "variable" declaration (or otherwise declared
>
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 expre
Al 17/03/13 13:54, En/na Marco van de Voort ha escrit:
> In our previous episode, Sven Barth said:
>>>
>>> Texas Instruments' Pascal had an extension of the with statement, IIRC
>>> it used = instead of AS
>>>
>>> With a=VeryLongNameForARecord, b=AnotherRecordWithAVeryLongName do ...
>>
>> Now THAT
Al 17/03/13 13:16, En/na Sven Barth ha escrit:
> On 17.03.2013 11:42, Paul Ishenin wrote:
>> 17.03.13, 18:25, Sven Barth пишет:
With a=VeryLongNameForARecord, b=AnotherRecordWithAVeryLongName do ...
>>>
>>> Now THAT is really unpascalish... either ":=" or the already suggested
>>> "as"...
>>
>
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 "variab
In our previous episode, Sven Barth said:
> >
> > Texas Instruments' Pascal had an extension of the with statement, IIRC
> > it used = instead of AS
> >
> > With a=VeryLongNameForARecord, b=AnotherRecordWithAVeryLongName do ...
>
> Now THAT is really unpascalish... either ":=" or the already sugge
In our previous episode, Sven Barth said:
> > I think having functions/procedures with no arguments callable with
> > procedurename() is un-pascal-like as well, but it hardly bothers me that
> > FPK allows it. Just because I don't love it doesn't mean others don't.
> > (There is a lot of C lik
On 17.03.2013 11:42, Paul Ishenin wrote:
17.03.13, 18:25, Sven Barth пишет:
With a=VeryLongNameForARecord, b=AnotherRecordWithAVeryLongName do ...
Now THAT is really unpascalish... either ":=" or the already suggested
"as"...
Why? Constants and Types are also use '=' instead of ':=' for assi
On 17.03.2013 11:53, Mattias Gaertner wrote:
On Sun, 17 Mar 2013 11:25:05 +0100
Sven Barth wrote:
[...]
Now THAT is really unpascalish... either ":=" or the already suggested
"as"...
The AS syntax bites already existing syntax.
Right. Then better ":=".
Regards,
Sven
_
On Sun, 17 Mar 2013 19:05:05 +0800
Xiangrong Fang wrote:
> > The AS syntax bites already existing syntax.
>
> May I know what's the existing syntax?
with A as T do
Mattias
___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freep
> The AS syntax bites already existing syntax.
May I know what's the existing syntax?
___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
On Sun, 17 Mar 2013 11:25:05 +0100
Sven Barth wrote:
>[...]
> Now THAT is really unpascalish... either ":=" or the already suggested
> "as"...
The AS syntax bites already existing syntax.
Mattias
___
fpc-pascal maillist - fpc-pascal@lists.freepasca
17.03.13, 18:25, Sven Barth пишет:
With a=VeryLongNameForARecord, b=AnotherRecordWithAVeryLongName do ...
Now THAT is really unpascalish... either ":=" or the already suggested
"as"...
Why? Constants and Types are also use '=' instead of ':=' for assignments.
Best regards,
Paul Ishenin
_
On 17.03.2013 11:07, Luca Olivetti wrote:
Al 17/03/13 03:37, En/na Flávio Etrusco ha escrit:
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
Al 17/03/13 03:37, En/na Flávio Etrusco ha escrit:
> 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.
On 17.03.2013 06:00, Flávio Etrusco wrote:
On Sun, Mar 17, 2013 at 12:16 AM, Daniel Gaspary wrote:
On Sun, Mar 17, 2013 at 12:07 AM, 印場 乃亜 wrote:
On 2013/03/17, at 11:37, Flávio Etrusco wrote:
Daniel, I find this hack as ingenious as atrocious ;-)
But thinking about it a bit, when FPC gets
On 17.03.2013 04:07, 印場 乃亜 wrote:
I think having functions/procedures with no arguments callable with
procedurename() is un-pascal-like as well, but it hardly bothers me that FPK
allows it. Just because I don't love it doesn't mean others don't. (There is
a lot of C like syntax that has cree
On Sun, Mar 17, 2013 at 12:16 AM, Daniel Gaspary wrote:
> On Sun, Mar 17, 2013 at 12:07 AM, 印場 乃亜 wrote:
>> On 2013/03/17, at 11:37, Flávio Etrusco wrote:
>>> Daniel, I find this hack as ingenious as atrocious ;-)
>>> But thinking about it a bit, when FPC gets generic methods you can
>>> make th
On Sun, Mar 17, 2013 at 12:07 AM, 印場 乃亜 wrote:
> On 2013/03/17, at 11:37, Flávio Etrusco wrote:
>> 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!
I was thinking about this, not specifical
> Actually the only thing that makes me uncomfortable about the keyword "as",
> is that
> it strangely reminds me of SQL. I suppose that isn't a bad thing though.
No problem with SQL, but "as" is already safe typecast, remember? ;-)
-Flávio
___
fpc-pa
Hi,
On 2013/03/17, at 11:37, Flávio Etrusco wrote:
>
> No, he's saying that *his hack* using class helper wouldn't cover this
> case (two objects in the same 'with' clause).
>
Well, more to the point, it only works with OOP. I use WITH on structures,
etc. all the time, so ... yes implementing
Hi,
Also with using the "longobj" below, you have to declare it first (yet more
manual temporary/helper variables).
Also, once you do that, you don't need with as much to begin with since you
could use a single char. variable name.
BTW, I don't think Daniel was suggesting that we actually use
On Sat, Mar 16, 2013 at 10:14 PM, Xiangrong Fang 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
>
> > 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 d
On Sat, Mar 16, 2013 at 7:55 PM, Xiangrong Fang wrote:
> I don't think a class helper is worth for this stuff, if I need to write a
> helper I would rather do this:
I am not sure that I understand your point.
The Class helper was a way to show how it's possible. And with that
helper, ALL objects
shiruba 's example is better than mine, and
was exactly the reason I posted this suggestion.
I don't think a class helper is worth for this stuff, if I need to write a
helper I would rather do this:
longobj := BigLongThingIDontWantToWriteOutEverySingleTime;
With longobj do begin
Height := 100;
On Sat, Mar 16, 2013 at 3:02 PM, 印場 乃亜 wrote:
> With BigLongThingIDontWantToWriteOutEverySingleTime do
> begin
> Height := 100;
> Width := 200;
> ...
> SomeOtherObject.Submit(BigLongThingIDontWantToWriteOutEverySingleTime);
> end;
>
> Notice how I have to write the long thin
Hi,
I also think this would be useful, but for other reasons, often times I end up
with code like the following:
With BigLongThingIDontWantToWriteOutEverySingleTime do
begin
Height := 100;
Width := 200;
...
SomeOtherObject.Submit(BigLongThingIDontWantToWriteOutEverySingleTim
; 发送自魅族MX
>
> 原始邮件
> 发件人:Sven Barth
> 时间:3月16日 17:12 周六
> 收件人:FPC-Pascal users discussions
> 主题:Re: [fpc-pascal] a proposal about "with" syntax
>
>
> Am 16.03.2013 07:14 schrieb "Xiangrong Fang" :
> >
> >
In my example, you can use Items[], but in my real project it is a record with
发送自魅族MX
原始邮件
发件人:Sven Barth
时间:3月16日 17:12 周六
收件人:FPC-Pascal users discussions
主题:Re: [fpc-pascal] a proposal about "with" syntax
>Am 16.03.2013 07:14 schrieb "Xiangrong Fang&
Am 16.03.2013 07:14 schrieb "Xiangrong Fang" :
>
> Suppose I have the following class:
>
> type
> TMyClass = class
> public
> property Caption: string read FCaption write FCaption;
> property Items[Index: Integer]: string read GetItem write SetItem;
default;
> function Count: Intege
Suppose I have the following class:
type
TMyClass = class
public
property Caption: string read FCaption write FCaption;
property Items[Index: Integer]: string read GetItem write SetItem;
default;
function Count: Integer;
end;
I would like to do this:
with MyClassInstance as mci
57 matches
Mail list logo