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

Michael Van Canneyt michael at freepascal.org
Tue May 1 10:52:32 CEST 2018



On Tue, 1 May 2018, Mattias Gaertner wrote:

> 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.

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.


More information about the fpc-pascal mailing list