public/private/stable/unstable
Aaron Bentley
aaron at aaronbentley.com
Wed Aug 27 01:30:15 BST 2008
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Robert Collins wrote:
> On Tue, 2008-08-26 at 19:52 -0400, Aaron Bentley wrote:
>> I would like people to be able to tell, at a glance, when a method is
>> completely safe to use. I think requiring reading the docstring of
>> every non _ method would be burdensome.
>
> I think 'safe to use' is simply too complex to encapsulate in the method
> name. More below.
>
>> How about:
>> _ -> unsupported-AND-private unless the docstring says otherwise
>> no _ -> supported and public.
>>
>> So you'd signal unsupported-and-public using a _ with a docstring.
>
> I'd be happy with this.
>
> Won't this will force every method on internal objects to be _ prefixed
> though?
I'm not sure what "internal" encompasses here. For example,
VersionedFiles is a stable API, but the VF instances on repositories
ought to be considered private.
So for them, constructing your own and doing what you like is fine. But
accessing a repository's _versionedfiles member would not be kosher.
For classes whose existence or signature is not guaranteed, constructing
your own instance would refer to the class name, and that should have a
_ prefix.
Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFItKAX0F+nu1YWqI0RApYhAJ9mMjWu0a5Fb0tRWAEFsrTOtE0dWgCeJ0du
9xnc0VK7xKQB13N2OoTcJeM=
=0Hfs
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list