for discussion None vs null: vs current:

Robert Collins robertc at robertcollins.net
Wed Jul 19 01:17:20 BST 2006


- None is supported as a value in the language just fine - and data
types like lists and dictionaries and sets have no confusion storing
None, and also having the ability to indicate that a key is missing etc.
I'm not sure what historical issues we had, but I see a useful way out
anyway - see NOT_A_REVISION

- NULL_REVISION has semantic meaning, and this makes it very unlike the
C NULL pointer which has no meaning, and is a wildcard for type - it
matches any 'object' (in C). I can see that the intent of our current
NULL_REVISION is not like NaN, and thus it works like the EMPTY_REVISION
I'm proposing. I think EMPTY_REVISION has a closer semantic fit to
people reading the code - folk reading the word NULL do not know /which/
NULL to interpret it as.

- that said, perhaps there is a happy medium ground. I propose an
additional constant - 'NOT_A_REVISION' which will serialise as ':', and
explicitly has -no- Tree to represent it, its invalid to use in all
apis. It will be represented in python as None, and if serialised as
':'. The use for this is to allow writing a list of whatspace separated
revision ids, e.g.:
foo bar gam : more data here
would be safely parsable as:
revids = ['foo', 'bar', 'gam']
comment = 'more data here'

As for delimiters, I dont see our very small selection of constants to
be a burden, it does not collide with our generated revisionids, and
revids from other systems can be prefixed: as long as there is not a VCS
called 'current', there should never be a conflict with 'current:'.
Using : is simple, clear and easy to read.


Current proposal:
EMPTY_REVISION - 'empty:'
NULL_REVISION - 'null:'
CURRENT_TREE_REVISION - 'current:'
None aka NOT_A_REVISION - ':'

open discussion points:
 * should we use other delimiters than :.
 * does NOT_A_REVISION make sense?

-Rob
-- 
GPG key available at: <http://www.robertcollins.net/keys.txt>.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060719/7259c444/attachment.pgp 


More information about the bazaar mailing list