Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

No nil reader/writers

#12

Having a nil reader/writer for a Delegate means the DelegateHash will not delegate get/set operations and instead stores the value internally. For example


    def [](key)
      return store[key] unless delegate = delegates[key]
      
      case
      when bound? && delegate.reader
        receiver.send(delegate.reader)
      when store.has_key?(key)
        store[key]
      else
        store[key] = delegate.default
      end
    end

When the reader is nil, key will ALWAYS be used as the storage key and indifferent access (which is implemented through delegates) is no longer respected. Same holds in the analagous writer code.

Nil readers and writers are a weird case and should be removed.

Reported by bahuvrihi · March 5th, 2009 @ 11:28 AM

State: resolved
Milestone: none
Assigned to: bahuvrihi bahuvrihi

Activity

  1. bahuvrihi
    bahuvrihi
    • Assigned user set to bahuvrihi
    • State changed from new to resolved

    March 5th, 2009 @ 06:34 PM

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.