{$J} default setting for today

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

{$J} default setting for today

Mr Bee
Hi,
 

"Support for assigning values to typed constants is controlled by the {$J} directive: it can be switched off, but is on by default (for Turbo Pascal compatibility). Initialized variables are always allowed."


"In early versions of Delphi and Object Pascal, typed constants were always writeable, corresponding to the {$J+} state. Old source code that uses writeable typed constants must be compiled in the {$J+} state, but for new applications it is recommended that you use initialized variables and compile your code in the {$J-} state."

I think we should follow Delphi in this case. Typed constant should not be writeable by default. That's what a constant should be. The old behavior is a flaw. At least let {$J-} be the default for {$MODE DELPHI} and {$MODE OBJFPC}.

What do you think?

–Mr Bee


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: {$J} default setting for today

Bart-48
On 2/20/16, Mr Bee <[hidden email]> wrote:

> I think we should follow Delphi in this case. Typed constant should not be
> writeable by default. That's what a constant should be. The old behavior is
> a flaw. At least let {$J-} be the default for {$MODE DELPHI} and {$MODE
> OBJFPC}

Yes please, break a ton of existing projects.

Bart
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: {$J} default setting for today

Jonas Maebe-2
In reply to this post by Mr Bee
Mr Bee wrote:
> I think we should follow Delphi in this case. Typed constant should not
> be writeable by default. That's what a constant should be. The old
> behavior is a flaw. At least let {$J-} be the default for {$MODE DELPHI}
> and {$MODE OBJFPC}.
>
> What do you think?

It can maybe be changed for {$mode delphiunicode}


Jonas
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: {$J} default setting for today

Graeme Geldenhuys-6
In reply to this post by Bart-48
On 2016-02-20 13:09, Bart wrote:
> Yes please, break a ton of existing projects.

Yes, then they can finally fix there code and use global variables instead.

If it was originally implemented for Turbo Pascal compatibility, why is
it enabled for ObjFPC and Delphi modes?

Regards,
  - Graeme -

--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key:  http://tinyurl.com/graeme-pgp
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: {$J} default setting for today

Jonas Maebe-2
Graeme Geldenhuys wrote:
> If it was originally implemented for Turbo Pascal compatibility, why is
> it enabled for ObjFPC and Delphi modes?

Because original Delphi versions also had {$j+} by default.


Jonas
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal