Yes, it is perfectly clear to a newbie, because it's the simplest
case. That's why I coded it this way initially, it seemed simpler.
What isn't immediately obvious is all the other special fields that
can appear in documents and in other contexts. How to make that
consistent? I tried, but couldn't keep it simple. The problem was
special names in various structures no longer have a simple rule to
follow, but instead you must know if this field appears in a document
at any time, then it starts with underscore in other structures.
The current rule maybe not the most intuitive to a newbie, but it is
far more consistent and easier to work with then when using the deeper
APIs. The only 2 other workable solutions I see is to either stuff
everything special into a _meta structure or only use HTTP headers for
all CouchDB meta information. But after having spent much time
thinking about this issue, I think the current rule is the better
compromise.
-Damien
On Dec 29, 2008, at 8:58 AM, Geir Magnusson Jr. wrote:
That rule would have been perfectly clear to me as a newbie.
+1
geir
On Dec 29, 2008, at 8:55 AM, Antony Blakey wrote:
On 29/12/2008, at 11:11 PM, Damien Katz wrote:
The problem was there where other reserved fields in documents
that started with underscore, but in other places the fields
wouldn't have an underscore. Keep track of which fieldname had
underscores and where became confusing. The rule was changed to be
simpler to understand and deal with.
A simpler rule is: _rev is the name no matter where it appears,
same with _id. I'd go so far as say that this kind of rule is so
fundamental to our idea of identity and naming, that it doesn't
even count as a rule. And there had better be a really good reason
to introduce a rule contrary to such an strongly implicit and
intrinsic concept.
And as far as 'Keeping track of which fieldname had underscores",
it would seem that the current situation is the worst, because you
have to keep track not based on identity e.g. _rev and _id, but
rather on context, which is a dynamic and more intellectually
demanding concept than semantic identity. Furthermore, in this
scheme, names must be mapped under structural transformation (such
as copying the _id and _rev fields from one context to another),
which complicates generic transformations.
IMO the name isn't "rev" with sometimes an underscore, rather the
name IS "_rev". Same with "_id".
A single name for a concept, lexically consistent, is less
cognitive load both initially and on an ongoing basis.
Antony Blakey
-------------
CTO, Linkuistics Pty Ltd
Ph: 0438 840 787
The ultimate measure of a man is not where he stands in moments of
comfort and convenience, but where he stands at times of challenge
and controversy.
-- Martin Luther King