Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make default a thunk? #22

Open
bbc2 opened this issue Nov 20, 2019 · 1 comment
Open

Make default a thunk? #22

bbc2 opened this issue Nov 20, 2019 · 1 comment

Comments

@bbc2
Copy link
Member

bbc2 commented Nov 20, 2019

The fact that default is a value makes it static. In some cases, like generating random values and incrementing IDs, it would be practical to customize default so that it can return a different value for a given factory function (I guess it could even be the default behavior, but it's not my issue here).

This can be worked around by creating factory functions manually but I think this defeats the purpose of this PPX.

So, would it make sense to be able to define default as function?

let default () =
  ...
@leamingrad
Copy link
Contributor

That sounds sensible to me, I would be in favour of this change

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants