bucklescript.github.io icon indicating copy to clipboard operation
bucklescript.github.io copied to clipboard

draft about new lazy encoding

Open bobzhang opened this issue 4 years ago • 5 comments

bobzhang avatar May 13 '20 09:05 bobzhang

This is cool! Also I learned something, I didn’t know pattern match was an alternative to calling Lazy.force 🤔

TheSpyder avatar May 13 '20 13:05 TheSpyder

@bobzhang This is a good improvement, nicely done!

I have a question that may be better converted to an issue in the BuckleScript repo. Would you consider changing the representation of lazy values to say something like "unrealized" or "pending" instead of "todo". I'm betting folks will be confused if they see "todo" in their output (either code or console).

My reasoning for the above is that "todo" generally represents things that need to be addressed in code, and it may make sense to generate another keyword.

anmonteiro avatar May 13 '20 15:05 anmonteiro

@anmonteiro the problem with a longer string is it'll be repeated for every lazy value, which might bloat the app size depending on how much it's used

maybe true/false would be better? 🤔

TheSpyder avatar May 14 '20 04:05 TheSpyder

@anmonteiro @TheSpyder good idea, I am going to rename it to {RE_LAZY_DONE : true|false}

https://github.com/BuckleScript/bucklescript/pull/4384

bobzhang avatar May 14 '20 05:05 bobzhang

@bobzhang cool, maybe later there can be a "minify" compiler mode that shrinks the key string to a single character :joy: something I'd like for some of my records-as-objects too :joy:

TheSpyder avatar May 14 '20 06:05 TheSpyder