[fpc-pascal] Next language feature for pas2js...

Mattias Gaertner nc-gaertnma at netcologne.de
Tue May 1 10:29:14 CEST 2018


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

> > On May 1, 2018, at 2:03 PM, Michael Van Canneyt <michael at 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.

A const inside an external class already works:

type
  TMyExt = class external name 'Bla'
    const LoVersion: GLFloat;
    const HiVersion: GLFloat; external name 'hiversion';
  end;


Mattias



More information about the fpc-pascal mailing list