Re: [fpc-devel] Variable can not be initialized by named constant

2009-03-01 Thread Alexander Klenin
On Mon, Mar 2, 2009 at 07:34, Daniël Mantione wrote: > This is a debate that has been held quite a few times :) If you look at > typed consts from the point of view what a mathematical constant is, yes, > it's completely absurd that you can write to them. >From _mathematical_ point of view assign

Re: [fpc-devel] Variable can not be initialized by named constant

2009-03-01 Thread Daniël Mantione
Op Mon, 2 Mar 2009, schreef Alexander Klenin: On Mon, Mar 2, 2009 at 03:16, Daniël Mantione wrote: Making typed constants writeable has been a disputed feature of the Borland dialect, I agree with that, but fact of the matter is they are writeable and thus cannot form a constant expression.

Re: [fpc-devel] Variable can not be initialized by named constant

2009-03-01 Thread Alexander Klenin
On Mon, Mar 2, 2009 at 03:16, Daniël Mantione wrote: > Making typed constants writeable has been a disputed feature of the Borland > dialect, I agree with that, but fact of the matter is they are writeable and > thus cannot form a constant expression. The fact that there exists a $J > directive d

Re: [fpc-devel] Variable can not be initialized by named constant

2009-03-01 Thread Daniël Mantione
Op Mon, 2 Mar 2009, schreef Alexander Klenin: Since issue http://bugs.freepascal.org/view.php?id=13256 was marked resolved, I think this is quite reasonable to expect this to work. The writeability of constants is IMNSHO just an ugly leftover from Delphi history, and should be disabled in _bot

Re: [fpc-devel] Variable can not be initialized by named constant

2009-03-01 Thread Jonas Maebe
On 01 Mar 2009, at 16:16, Jonas Maebe wrote: On 01 Mar 2009, at 15:58, Alexander Klenin wrote: On Mon, Mar 2, 2009 at 00:47, Jonas Maebe wrote: This depends on a mode switch. Use {$j-} to turn off the ability to write to typed constants. Maybe it's off by default in your version of De

Re: [fpc-devel] Variable can not be initialized by named constant

2009-03-01 Thread Jonas Maebe
On 01 Mar 2009, at 15:58, Alexander Klenin wrote: On Mon, Mar 2, 2009 at 00:47, Jonas Maebe wrote: This depends on a mode switch. Use {$j-} to turn off the ability to write to typed constants. Maybe it's off by default in your version of Delphi. I know. I argued that it should be off by

Re: [fpc-devel] Variable can not be initialized by named constant

2009-03-01 Thread Alexander Klenin
On Mon, Mar 2, 2009 at 00:47, Jonas Maebe wrote: >> Is rejected by Delphi, but compiled by FPC, which is a compatibility >> bug in itself. > > This depends on a mode switch. Use {$j-} to turn off the ability to write to > typed constants. Maybe it's off by default in your version of Delphi. I know

Re: [fpc-devel] Variable can not be initialized by named constant

2009-03-01 Thread Jonas Maebe
On 01 Mar 2009, at 15:29, Alexander Klenin wrote: I think this is quite reasonable to expect this to work. The writeability of constants is IMNSHO just an ugly leftover from Delphi history, and should be disabled in _both_ delphi and objfpc modes: {$IFDEF FPC}{$MODE DELPHI}{$ENDIF} const x: in

[fpc-devel] Variable can not be initialized by named constant

2009-03-01 Thread Alexander Klenin
Since issue http://bugs.freepascal.org/view.php?id=13256 was marked resolved, I can not add comments, so I'd like to discuss it here. Original report claimed that code const c: SomeType = ; var y: t = c; begin end. Works for primitive types, but not the complex ones. This was an error on my part