Quantcast

Saving protocols

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Saving protocols

Jeff M.
How do I save a protocol in a package? Maybe it's automatic when an
object using the protocol is stored in the package, but that isn't
immediately obvious.

Thanks.

Jeff M.


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Saving protocols

Chris Uppal-3
Jeff,

> How do I save a protocol in a package? Maybe it's automatic when an
> object using the protocol is stored in the package, but that isn't
> immediately obvious.

IIRC, the definition of a Protocol is saved as part of every package which
contains a class which explicitly implements it.  They cannot be saved
separately (using the IDE tools -- of course you could save one as a Smalltalk
"file-out", or an STB file, or something similar if you wanted).

Not a particularly good implementation, IMO.  I would rather see Protocols as
full "first class" code artefacts[*], belonging to a specific package, and
saved with that package -- but that's not the way it works.

Also there's a known bug introduced in D6. From my original report:

===============
In D6 it seems to be possible to remove a method from a class even though it is
needed in order to satisfy a protocol which the class conforms to.  The class
is implicitly, and with no warning, removed from the protocol (or do I mean:
the protocol is removed from the class ?).

In D5 we were given the choice between cancelling the operation, removing the
class from the protocol, or removing the selector from the protocol.  I think
that's the correct behaviour.
===============

which means that Protocols are currently not "policing" conformance as they are
designed to.

    -- chris

([*] with associated commentary)


Loading...