DEV Community


Discussion on: Inlined values in BuckleScript

sukantpal profile image
Sukant Pal • Edited

Thanks for this article! I am using this technique to binding enumerations in the @pixi/constants package (here:

module TYPES: {
    type t = pri int;

    let half_float: t;
} = {
    type t = int;

    let half_float = 36193;

instead of

module TYPES = {
  [@bs.scope "TYPES"] [@bs.module "@pixi/constants"]
  external half_float = 36193;

Do you think this would be the correct approach?

yawaramin profile image
Yawar Amin Author

Hi, no problem. Yes the first code sample looks correct to me. If you add the [@bs.inline] attribute in the correct places as explained in the post, the compiler will generate constant literals at the right places.