Skip to content
This repository has been archived by the owner on Dec 6, 2017. It is now read-only.

optional Inject.get and .getByKey (or fallback value without throwing exception) #185

Open
isoos opened this issue Oct 2, 2014 · 0 comments

Comments

@isoos
Copy link

isoos commented Oct 2, 2014

Injector.get(Type) and .getByKey(Key) will throw an exception if the key is not bound. If the component depends on many optional configuration item, wrapping these calls into try-catch blocks is about 50-60x slower than just returning a null value or calling a fallback function.

Please add support for having optional dependencies e.g. by following the num.parse() or the Iterable.firstWhere() method signature for fallbacks.

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

No branches or pull requests

1 participant