[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 = value; var y: t = c; begin end. Works for primitive types, but not the complex ones. This was an error on

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:

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 jonas.ma...@elis.ugent.be 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

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 jonas.ma...@elis.ugent.be 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

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

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 daniel.manti...@freepascal.org 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

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 daniel.manti...@freepascal.org 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

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 daniel.manti...@freepascal.org 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