u1db-discuss team mailing list archive
-
u1db-discuss team
-
Mailing list archive
-
Message #00019
Re: API Design
On 11/15/2011 04:36 PM, Mikkel Kamstrup Erlandsen wrote:
I am not sure I agree. If there is a Document class the APIs could be
largely equivalent on different runtimes:
my_int = doc.get_int32("bar") # Python // or JS
var my_int = doc.get_int32 ("bar") // Vala
int32_t my_int = u1db_document_get_int32 (doc, "bar"); // C
int32_t my_int = doc->get_int32 ("bar"); // C++
(and yes, Python, JS, and C++ may use map comprehensions and the
likes, but something like doc.get_int32("bar") is still useful for
clarity and type safety)
I think this is good argument why we dont want to force the same
document class on all platforms.
I think the rule here is:
- Everyone shares the same http api where we use json as encoding
- Each language is free to implement their own idiomatic version of that
api.
In this way, if you know the calls that make the u1db interface and you
know the language, it will be very easy to understand where the language
lib differs from the raw network calls.
What do you guys think?
Lucio.
References