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.

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

[fpc-devel] Wrong docs: not initialized global variables

2018-03-24 Thread Ondrej Pokorny
Due to the "Multiple variable initialization" thread I took a look into FPC documentation: https://www.freepascal.org/docs-html/ref/refse24.html There it says: By default, simple variables in Pascal are not initialized after their declaration. Any assumption that they contain 0 or any other

Re: [fpc-devel] Why debugger does not "step in"?

2018-03-24 Thread Jonas Maebe
On 24/03/18 19:46, Martin Frb wrote: On 24/03/18 19:34, Jonas Maebe wrote: https://bugs.freepascal.org/view.php?id=14399 Will your fix (2018-01-13 16:59) be in 3.0.6? Or 3.2 only? 3.2 Jonas ___ fpc-devel maillist -

Re: [fpc-devel] Why debugger does not "step in"?

2018-03-24 Thread Gennady Agranov
>>> It isn't a method of an "interface"? interfaces indeed have this issue. It is the case - thanks! Is it "nothing can be done about it" case? Is there an already submitted bug? Thanks, Gennady On 3/24/2018 4:42 AM, Martin Frb wrote: On 24/03/18 02:24, Gennady Agranov wrote: Hi, I use

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

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 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

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

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

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 > 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

Re: [fpc-devel] Why debugger does not "step in"?

2018-03-24 Thread Martin Frb
On 24/03/18 17:58, Gennady Agranov wrote: >>> It isn't a method of an "interface"? interfaces indeed have this issue. It is the case - thanks! Is it "nothing can be done about it" case? Is there an already submitted bug? Not sure if there is a bug report. I am not even sure if this is: -

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

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

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

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

Re: [fpc-devel] Why debugger does not "step in"?

2018-03-24 Thread Jonas Maebe
On 24/03/18 19:30, Martin Frb wrote: On 24/03/18 17:58, Gennady Agranov wrote: >>> It isn't a method of an "interface"? interfaces indeed have this issue. It is the case - thanks! Is it "nothing can be done about it" case? Is there an already submitted bug? Not sure if there is a bug

Re: [fpc-devel] Why debugger does not "step in"?

2018-03-24 Thread Martin Frb
On 24/03/18 19:34, Jonas Maebe wrote: https://bugs.freepascal.org/view.php?id=14399 Will your fix (2018-01-13 16:59) be in 3.0.6? Or 3.2 only? ___ fpc-devel maillist - fpc-devel@lists.freepascal.org

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

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

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

Re: [fpc-devel] Wrong docs: not initialized global variables

2018-03-24 Thread Sven Barth via fpc-devel
Ondrej Pokorny schrieb am Sa., 24. März 2018, 20:49: > This is not correct. Global simple variables are always initialized. At > least in Delphi it is so: > http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Variables_(Delphi) "If > you do not explicitly initialize a global

Re: [fpc-devel] Wrong docs: not initialized global variables

2018-03-24 Thread Ondrej Pokorny
On 24.03.2018 23:33, Ondrej Pokorny wrote: Another question about this sentence in FPC docs: "Managed types are always initialized: in general this means setting the reference count to zero, or setting the pointer value of the type to Nil." Does it mean I can assume a local

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:

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

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

Re: [fpc-devel] Wrong docs: not initialized global variables

2018-03-24 Thread Maciej Izak
2018-03-24 20:49 GMT+01:00 Ondrej Pokorny : > Does it mean I can assume a local string variable is always (=whenever the > routine is called) initialized to ''? I.e. that TestB always returns 'a'? > > function TestB: string; > var B: string; > begin > B := B + 'a'; > Result

Re: [fpc-devel] Wrong docs: not initialized global variables

2018-03-24 Thread Ondrej Pokorny
On 24.03.2018 23:00, Sven Barth via fpc-devel wrote: Ondrej Pokorny > schrieb am Sa., 24. März 2018, 20:49: This is not correct. Global simple variables are always initialized. At least in Delphi it is so:

Re: [fpc-devel] Request for applying patch #33124

2018-03-24 Thread Ondrej Pokorny
On 22.03.2018 18:47, Jonas Maebe wrote: On 22/03/18 16:14, Ondrej Pokorny wrote: it's nothing serious, only a missing Cocoa header definition. Those headers have been generated automatically. They should never be manually patched. Updated versions are indeed needed, but that will probably

Re: [fpc-devel] Why debugger does not "step in"?

2018-03-24 Thread Martin Frb
On 24/03/18 02:24, Gennady Agranov wrote: Hi, I use FPC 3.0.4 / Lazarus 1.8.2 I am seeing the same behavior when I debug the program using Lazarus IDE under Win64 and Linux64 When I want to "step in" into my own function/procedure - GDB simply steps over... If I set a breakpoint inside

[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 -

Re: [fpc-devel] Request for applying patch #33124

2018-03-24 Thread Jonas Maebe
On 24/03/18 10:15, Ondrej Pokorny wrote: On 22.03.2018 18:47, Jonas Maebe wrote: On 22/03/18 16:14, Ondrej Pokorny wrote: it's nothing serious, only a missing Cocoa header definition. Those headers have been generated automatically. They should never be manually patched. Updated versions