Closed sagmor closed 8 years ago
I believe it would make sense to cast keys into strings
Right now the following happens if you switch between Symbols and Strings:
container = Dry::Container.new container.register(:foo, 'bar') container[:foo] # => "bar" container['foo'] # => Dry::Container::Error: Nothing registered with the key "foo"
The confusion appears when you start to namespace things, for example:
container = Dry::Container.new container.namespace(:test) do register(:foo, 'bar') end # Now it's a string container['test.foo'] # => "bar"
I think it would be clearer if things got stored as strings by default. If you think that's better I can push a PR with the change.
I agree, consistency FTW
I believe it would make sense to cast keys into strings
Right now the following happens if you switch between Symbols and Strings:
The confusion appears when you start to namespace things, for example:
I think it would be clearer if things got stored as strings by default. If you think that's better I can push a PR with the change.