[Pas2js] Records as pure data?

Ryan Joseph ryan at thealchemistguild.com
Wed May 9 11:46:46 CEST 2018


I got pas2js working enough now to do some tests and see the translations. First thing glaring out is that you’re missing a great opportunity to fix something which is broken and terrible in JS plus make working with WebGL far easier.

As it is now I see records translated as classes, which is good but there really ought to be a “pure data only” variant which maps to an array.

For example:

type
  TVec2 = data record
    x, y: single;
  end;

// var v = new Array(0, 0);
v := TVec2.Create;

// v[0] = 1;
v.x := 1;

fields just reference array indexes by name, so x = 0, y = 1 in this example.

Does that work?

Regards,
	Ryan Joseph



More information about the Pas2js mailing list