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

Support for object and callback defaults #4

Open
crazy4groovy opened this issue Nov 6, 2021 · 0 comments
Open

Support for object and callback defaults #4

crazy4groovy opened this issue Nov 6, 2021 · 0 comments

Comments

@crazy4groovy
Copy link

crazy4groovy commented Nov 6, 2021

Hi, I like this lib a lot; it reminds me of Groovy's support for default values:
https://blog.mrhaki.com/2012/10/groovy-goodness-create-list-with.html

There are a couple of interesting expansions you can consider with this lib:

  1. Consider allowing objects to be defaults, not just literals. I assume this would mean the default cannot simply be passed back, but must first be assigned to target[property]. (However in order to avoid object reference hell, perhaps # 2 will help too.)

  2. Accept a callback for the default option, that takes in the index and assigns the returned value (like a new object!) to that array item.

@crazy4groovy crazy4groovy changed the title Support for object default Support for object and callback defaults Nov 6, 2021
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

1 participant