ObjC 2.0 Class +encodeWithCoder:

  • I have a DO-based application which uses a Class object as a root
    proxy under 10.4- it works as expected. Objective-C 2.0 seems to have
    broken this option because Class no longer responds to -
    encodeWithCoder:.

    I am not able to think of a reason for this regression, but perhaps
    the new dynamic nature of Classes prevents my use-case.

    Is this a genuine regression or should I have never relied on passing
    Classes as root proxies?

    Thanks.
    -M
  • Class methods are prefixed with a +, and I don't think
    there ever was a documented +encodeWithCoder: method
    of NSObject or any other class, so it looks like it
    was simply a quirk of the runtime that this ever
    worked at all.

    Cheers,
    Chuck

    --- "A.M." <agentm...> wrote:

    > I have a DO-based application which uses a Class
    > object as a root
    > proxy under 10.4- it works as expected. Objective-C
    > 2.0 seems to have
    > broken this option because Class no longer responds
    > to -
    > encodeWithCoder:.
    >
    > I am not able to think of a reason for this
    > regression, but perhaps
    > the new dynamic nature of Classes prevents my
    > use-case.
    >
    > Is this a genuine regression or should I have never
    > relied on passing
    > Classes as root proxies?
    >
    > Thanks.
    > -M
    >

          ____________________________________________________________________________________
    Never miss a thing.  Make Yahoo your home page.
    http://www.yahoo.com/r/hs
  • No. Every where you can provide an instance, you should be able to
    provide a Class to.
    For example, it's perfectly legal to register a Class as a
    notification observer (and use a Class method as target).
    It also perfectly legal to register a Class as a delegate and
    implements Class method instead of instance methods to handle message.

    An Class method is just an instance method of the Class Object.

    Le 21 févr. 08 à 22:32, Charles Steinman a écrit :

    > Class methods are prefixed with a +, and I don't think
    > there ever was a documented +encodeWithCoder: method
    > of NSObject or any other class, so it looks like it
    > was simply a quirk of the runtime that this ever
    > worked at all.
    >
    > Cheers,
    > Chuck
    >
    > --- "A.M." <agentm...> wrote:
    >
    >> I have a DO-based application which uses a Class
    >> object as a root
    >> proxy under 10.4- it works as expected. Objective-C
    >> 2.0 seems to have
    >> broken this option because Class no longer responds
    >> to -
    >> encodeWithCoder:.
    >>
    >> I am not able to think of a reason for this
    >> regression, but perhaps
    >> the new dynamic nature of Classes prevents my
    >> use-case.
    >>
    >> Is this a genuine regression or should I have never
    >> relied on passing
    >> Classes as root proxies?
    >>
    >> Thanks.
    >> -M
    >>

    >
  • Am 21.02.2008 um 23:57 schrieb Jean-Daniel Dupas:

    > No. Every where you can provide an instance, you should be able to
    > provide a Class to.
    > For example, it's perfectly legal to register a Class as a
    > notification observer (and use a Class method as target).
    > It also perfectly legal to register a Class as a delegate and
    > implements Class method instead of instance methods to handle message.

    Hmmh - but what exactly do you expect the class method
    endodeWithCoder: to do?
    It's a class method, so it can't encode an instance.
    Do you really want to encode the class object itself?

    >
    >
    > An Class method is just an instance method of the Class Object.
    >
    > Le 21 févr. 08 à 22:32, Charles Steinman a écrit :
    >
    >> Class methods are prefixed with a +, and I don't think
    >> there ever was a documented +encodeWithCoder: method
    >> of NSObject or any other class, so it looks like it
    >> was simply a quirk of the runtime that this ever
    >> worked at all.
    >>
    >> Cheers,
    >> Chuck
    >>
    >> --- "A.M." <agentm...> wrote:
    >>
    >>> I have a DO-based application which uses a Class
    >>> object as a root
    >>> proxy under 10.4- it works as expected. Objective-C
    >>> 2.0 seems to have
    >>> broken this option because Class no longer responds
    >>> to -
    >>> encodeWithCoder:.
    >>>
    >>> I am not able to think of a reason for this
    >>> regression, but perhaps
    >>> the new dynamic nature of Classes prevents my
    >>> use-case.
    >>>
    >>> Is this a genuine regression or should I have never
    >>> relied on passing
    >>> Classes as root proxies?
    >>>
    >>> Thanks.
    >>> -M
    >>>

    >>

  • Le 25 févr. 08 à 15:53, Jens Miltner a écrit :

    >
    > Am 21.02.2008 um 23:57 schrieb Jean-Daniel Dupas:
    >
    >> No. Every where you can provide an instance, you should be able to
    >> provide a Class to.
    >> For example, it's perfectly legal to register a Class as a
    >> notification observer (and use a Class method as target).
    >> It also perfectly legal to register a Class as a delegate and
    >> implements Class method instead of instance methods to handle
    >> message.
    >
    > Hmmh - but what exactly do you expect the class method
    > endodeWithCoder: to do?
    > It's a class method, so it can't encode an instance.
    > Do you really want to encode the class object itself?

    I'm not the one who want to encode classes. I just says this method
    should be called.
    The original poster (A.M.) probably want to encode a structure that
    contains Class (like an array of Class or something like this).