rescript-lang / bucklescript.github.io

BuckleScript's documentation site
https://bucklescript.github.io
55 stars 87 forks source link

draft about new lazy encoding #211

Open bobzhang opened 4 years ago

TheSpyder commented 4 years ago

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

anmonteiro commented 4 years ago

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

TheSpyder commented 4 years ago

@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? 🤔

bobzhang commented 4 years ago

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

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

TheSpyder commented 4 years ago

@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: