Describe the bug
the :default keyword supports an "instance_exec" type of evaluation whereby default: -> { foo + bar }' reference the object in questions' fooand barmethods. however, when eitherfooorbarare, themselves, dry-initialized attributes, the default value will resolve tonil` due to being referenced prior to 'dry initialization'
To Reproduce
require 'dry-initializer'
class A
extend Dry::Initializer
option :foo, default: -> { bar }
option :bar, default: -> { 42 }
end.new
class B
extend Dry::Initializer
option :bar, default: -> { 42 }
option :foo, default: -> { bar }
end.new
pp A.new #=> #<A:0x0000000103009958 @bar=42, @foo=nil>
pp B.new #=> #<B:0x000000010302aea0 @bar=42, @foo=42>
Expected behavior
@bar == @foo == 42
My environment
n/a