Re: [fpc-devel] Multiple variable initialization

2018-04-04 Thread Ondrej Pokorny
On 31.03.2018 11:34, Anton Shepelev wrote: Initialisation is a special and redundant way to assign a value to a variable. Is this mixing of declaration and action a good idea? Why not keep them separate? LOL, I am not the one who wants to introduce initialisation of variables to Pascal. For y

Re: [fpc-devel] Multiple variable initialization - YES

2018-04-02 Thread Alexander Grotewohl
uses SysUtils; // inttostr procedure blank(a: array of pointer); var   i: longint; begin   for i:=low(a) to high(a) do // string(a[i]^):=''; string(a[i]^):='silly ~~~ '+IntToStr(i); end; var   s, i, l, {l,} y: string; begin   blank([@s, @i, @l, {@l,} @y]);   writeln(s); writeln(i)

Re: [fpc-devel] Multiple variable initialization - YES

2018-04-02 Thread Péter Gábor
Hi! I have bean read all of the emails in this topic and now I have to write :) : If multiple type declaration (A, B: Integer) are allowed then this new feature would not make difficulty to learn. Especially if we compare it to generics, what is already in the language and required/requires to le

Re: [fpc-devel] Multiple variable initialization

2018-04-01 Thread Marco van de Voort
In our previous episode, Ondrej Pokorny said: > var > ? A: Integer = 0; > begin > end; > > Is it a whim as well? Yes. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Re: [fpc-devel] Multiple variable initialization

2018-03-31 Thread Anton Shepelev
Florian Klaempfl to Ondrej Pokorny: > > Anyway, my favorite example of non-pascalish > > syntax within FPC are the +=, -= etc. operators. > > I really don't understand how they made it into > > FPC if so many FPC developers are stubbornly > > against simple and helpful extensions :) > > T

Re: [fpc-devel] Multiple variable initialization

2018-03-31 Thread Anton Shepelev
Ondrej Pokorny: > Is there a reason why multiple variable initial- > ization is forbidden? > > program Test; > var >A:Integer = 0; // allowed >B, C: Integer = 0; // not allowed > begin > end. > > Will a patch be applied that allows it? That means another complication of the language

Re: [fpc-devel] Multiple variable initialization

2018-03-25 Thread Ozz Nixon
Pre pre-initialization, I do it as a compile option: Modern Pascal v2.0.0 (LINUX,CPU64,X86_64,LITTLEENDIAN,1180323) Copyright (c) 2000..2017 by Ozz Nixon (Modern Pascal Solutions, LLC). ■ Produces Cross-Platform 32bit/64bit Encrypted Binaries. /usr/bin/mp2 [options] sourcefile [mo

Re: [fpc-devel] Multiple variable initialization

2018-03-24 Thread Alexander Grotewohl
It sounds more like you're making a case for all integers to be initialized to zero by default. I still fail to see any practical uses other than wanting to not type "integer" twice. Alex On 03/24/2018 11:20 AM, Ondrej Pokorny wrote: On 24.03.2018 15:46, Alexander Grotewohl wrote: The patch

Re: [fpc-devel] Multiple variable initialization

2018-03-24 Thread Florian Klaempfl
Am 24.03.2018 um 20:21 schrieb Ondrej Pokorny: > > Anyway, my favorite example of non-pascalish syntax within FPC are the > +=, -= etc. operators. I really don't understand how they made it into > FPC if so many FPC developers are stubbornly against simple and helpful > extensions :) The were add

Re: [fpc-devel] Multiple variable initialization

2018-03-24 Thread Ondrej Pokorny
On 24.03.2018 18:40, Jonas Maebe wrote: The C-syntax is indeed consequent, and that is what I referred to: the assignments work the same way as elsewhere in the program, so multiple initialisations are just as clear as single initialisations there. In Pascal, you have a special syntax for initi

Re: [fpc-devel] Multiple variable initialization

2018-03-24 Thread Michael Van Canneyt
On Sat, 24 Mar 2018, Ozz Nixon wrote: As an extension, it makes sense - but I would make it a forced command line switch and obscure $modeswitch. Modeswitched and command-line options only go so far. The problem with this approach is that, if I see someone elses code, I still have the conf

Re: [fpc-devel] Multiple variable initialization

2018-03-24 Thread Ozz Nixon
As an extension, it makes sense - but I would make it a forced command line switch and obscure $modeswitch. So the code can easily be ported to other pascal compilers, or versions of FPC down the road. I spend 8 to 12 hours a day porting Delphi (versions) of code to FPC. And the XE series really ma

Re: [fpc-devel] Multiple variable initialization

2018-03-24 Thread Ralf Quint
On 3/24/2018 6:54 AM, Sven Barth via fpc-devel wrote: Anthony Walter mailto:sys...@gmail.com>> schrieb am Sa., 24. März 2018, 14:51: If you were going to patch I'd also consider allowing: program Test; var B, C: Integer = 0, 1;  // sets B = 0, and C = 1 begin end. No,

Re: [fpc-devel] Multiple variable initialization

2018-03-24 Thread Jonas Maebe
On 24/03/18 17:54, Ondrej Pokorny wrote: Yes, both examples are much easier to read. You cannot convince me they are not. Then there's not much point in discussing. If you are talking about Ozz Nixon's post and the C-syntax: I was. int a, b, c; int a=0, b=0, c=0; What different syntax do

Re: [fpc-devel] Multiple variable initialization

2018-03-24 Thread Ondrej Pokorny
On 24.03.2018 16:51, Florian Klaempfl wrote: Am 24.03.2018 um 11:46 schrieb Ondrej Pokorny: Is there a reason why multiple variable initialization is forbidden? program Test; var   A: Integer = 0;    // allowed   B, C: Integer = 0; // not allowed begin end. Will a patch be applied that allow

Re: [fpc-devel] Multiple variable initialization

2018-03-24 Thread Ondrej Pokorny
On 24.03.2018 16:53, Jonas Maebe wrote: > You'd also have to support it at least for record field initialisers and default parameters. Oh yes, I'd also love to write procedure Test(const A, B, C, D: Integer = 0); instead of procedure Test(const A: Integer = 0; const B: Integer = 0; const C:

Re: [fpc-devel] Multiple variable initialization

2018-03-24 Thread R0b0t1
On Sat, Mar 24, 2018 at 10:53 AM, Jonas Maebe wrote: > In the end, pretty much every extra language feature makes both the compiler > and the language more complex. Therefore, I think the question for language > extensions should never be "is there a good reason not to allow this", but > "is it re

Re: [fpc-devel] Multiple variable initialization

2018-03-24 Thread Jonas Maebe
On 24/03/18 16:20, Ondrej Pokorny wrote: On 24.03.2018 15:46, Alexander Grotewohl wrote: The patch is to put them on separate lines. Preferably with meaningful comments for each. If FPC was changed at the whim of every programmer we'd end up with a huge mess that no longer resembles pascal. P

Re: [fpc-devel] Multiple variable initialization

2018-03-24 Thread Florian Klaempfl
Am 24.03.2018 um 11:46 schrieb Ondrej Pokorny: > Is there a reason why multiple variable initialization is forbidden? > > program Test; > var >   A: Integer = 0;    // allowed >   B, C: Integer = 0; // not allowed > begin > end. > > Will a patch be applied that allows it? As the first one is sup

Re: [fpc-devel] Multiple variable initialization

2018-03-24 Thread Ondrej Pokorny
On 24.03.2018 15:46, Alexander Grotewohl wrote: The patch is to put them on separate lines. Preferably with meaningful comments for each. If FPC was changed at the whim of every programmer we'd end up with a huge mess that no longer resembles pascal. Please tell me who decides about the border

Re: [fpc-devel] Multiple variable initialization

2018-03-24 Thread Ozz Nixon
Actually (for clarity) JavaScript does allow multi-initialization, however, does not require type: var a=0,b=0,c=0; // all are zero // and if your presetting to zero due to Pascal not pre-initializing variables, javascript does, so: var a,b,c; // all are zero var a=b=c=1; // C and most JavaScript

Re: [fpc-devel] Multiple variable initialization

2018-03-24 Thread Ondrej Pokorny
On 24.03.2018 15:41, Michael Van Canneyt wrote: On Sat, 24 Mar 2018, Ondrej Pokorny wrote: Is there a reason why multiple variable initialization is forbidden? program Test; var   A: Integer = 0;    // allowed   B, C: Integer = 0; // not allowed I think this is confusing to read. Are B and C

Re: [fpc-devel] Multiple variable initialization

2018-03-24 Thread Mattias Gaertner
On Sat, 24 Mar 2018 15:41:15 +0100 (CET) Michael Van Canneyt wrote: > On Sat, 24 Mar 2018, Ondrej Pokorny wrote: > > > Is there a reason why multiple variable initialization is forbidden? > > > > program Test; > > var > >   A: Integer = 0;    // allowed > >   B, C: Integer = 0; // not allowed

Re: [fpc-devel] Multiple variable initialization

2018-03-24 Thread Michael Van Canneyt
On Sat, 24 Mar 2018, Ondrej Pokorny wrote: Is there a reason why multiple variable initialization is forbidden? program Test; var   A: Integer = 0;    // allowed   B, C: Integer = 0; // not allowed I think this is confusing to read. Are B and C both initialized, or only B ? Javascript al

Re: [fpc-devel] Multiple variable initialization

2018-03-24 Thread Sven Barth via fpc-devel
Anthony Walter schrieb am Sa., 24. März 2018, 14:51: > If you were going to patch I'd also consider allowing: > > program Test; > var > B, C: Integer = 0, 1; // sets B = 0, and C = 1 > begin > end. > No, that is only confusing. Regards, Sven ___ fp

Re: [fpc-devel] Multiple variable initialization

2018-03-24 Thread Anthony Walter
If you were going to patch I'd also consider allowing: program Test; var B, C: Integer = 0, 1; // sets B = 0, and C = 1 begin end. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

[fpc-devel] Multiple variable initialization

2018-03-24 Thread Ondrej Pokorny
Is there a reason why multiple variable initialization is forbidden? program Test; var   A: Integer = 0;    // allowed   B, C: Integer = 0; // not allowed begin end. Will a patch be applied that allows it? Ondrej ___ fpc-devel maillist - fpc-devel@