[C++-sig] Re: New slice implementation

Jonathan Brandmeyer jbrandmeyer at earthlink.net
Thu Jan 8 22:20:19 CET 2004


On Thu, 2004-01-08 at 09:42, David Abrahams wrote:
> Thanks for your submission, Jonathan!  I can say right off that it
> looks like good code but it's missing tests and docs and I can't
> accept it without those.

Here is a start.  I think that this covers tests and examples.

Also, there is another patch to make slice_nil work right for both
object.slice() and freestanding slice objects.  Basically I made
slice_nil its own class, descended from object with only a default
constructor.  _ is a static const instantiation of slice_nil to serve as
the shortcut.  This makes slice_nil() an alias for PyNone as required
for freestanding slices and differentiates it from object as required
for object.slice().

I suppose I could have taken the same approach as the object.slice()
implementation for separating out slice_nil, but that would have taken
12 different constructors.

Even though the new semantics of slice_nil are wildly different, in
practice I think that it should still be source compatable for its
intended usage.  The tests in object.cpp continue to work properly.

WRT documentation, do you use some kind of semiautomatic doc generator
or just plain html editing?

Thanks,
-Jonathan Brandmeyer

-------------- next part --------------
A non-text attachment was scrubbed...
Name: slice_patches.diff
Type: text/x-patch
Size: 1773 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20040108/aad9dbb2/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: slice_test.cpp
Type: text/x-c++
Size: 3036 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20040108/aad9dbb2/attachment-0001.bin>


More information about the Cplusplus-sig mailing list