On Tue, 1 May 2018, Mattias Gaertner wrote:

On Tue, 1 May 2018 14:20:12 +0700
Ryan Joseph <r...@thealchemistguild.com> wrote:

> On May 1, 2018, at 2:03 PM, Michael Van Canneyt <mich...@freepascal.org> 
wrote:
> > Of sorts.
>  MyClass = Class external name 'my'
>  const
>    MyConst : integer
>  end;
> > Will emit MyClass.MyConst. The compiler needs to know the type.
I’m confused now.

I think you confused Michael. ;)

At the moment you can define external const like this:
var
 NaN: Double; external name 'NaN';
 Infinity: Double; external name 'Infinity';
 NegInfinity: Double; external name '-Infinity';

Note that the 'var' is a workaround till eventually pas2js supports
external 'const' without expression.

Well, I specially did not mention this, because I consider it a dirty hack.
a var doesn't protect you from assigning to it (it's a variable, after all).

One preferably shouldn't teach people bad habits. :)

Michael.
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to