[Pas2js] Class constant with "external" class
Mattias Gaertner
nc-gaertnma at netcologne.de
Sat Jan 27 13:50:08 CET 2018
On Sat, 27 Jan 2018 06:30:21 -0600 (CST)
warleyalex via Pas2js <pas2js at lists.freepascal.org> wrote:
>[...]
> class variable with "external" classes, I think should be a handy technique
> for setting conditions "before" an object is created from the class
> prototype.
>
> type
> TBase = class external name 'TBase' (TJSObject)
> public
> //class var cPublic : String = '{"name":"warleyx"}';
> class var cPublic : String;
> class const cTemp = '{"page:about2"}';
> end;
>
> so I think the compiler should emit this:
> //----------------------------------------
> this.cPublic = "";
> this.cTemp = "{\"page\":\"about2\"}";
>
> $mod.$main = function () {
> $mod.cPublic = "abcdef";
> window.console.log($mod.cPublic);
> window.console.log($mod.cTemp);
> };
> //----------------------------------------
Why should we loose a feature to define a const in two
ways?
Mattias
More information about the Pas2js
mailing list