Skip to content

Make default a thunk? #22

@bbc2

Description

@bbc2

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 () =
  ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions