General purpose library for name/value pairs.

Pawel Jakub Dawidek pjd at FreeBSD.org
Thu Jul 25 22:28:47 UTC 2013


On Tue, Jul 16, 2013 at 06:06:06PM -0400, Steve Kiernan wrote:
> On Mon, 8 Jul 2013 10:57:17 -0700
> Jordan Hubbard <jkh at mail.turbofuzz.com> wrote:
> 
> > 
> > On Jul 8, 2013, at 8:03 AM, Pawel Jakub Dawidek <pjd at freebsd.org> wrote:
> > 
> > > How about instead of supporting int8, uint8, int16, uint16, int32,
> > > uint32, int64 and uint64 I'd just support 'number' type, which would be
> > > uint64_t. This shouldn't break transporting signed values and because I
> > > don't support basic types like int, long, etc. casting or conversion has
> > > to be done anyway. This would reduce number of supported types to:
> > 
> > That's a good idea.  Since you're re-inventing Apple's XML property list API (but without serialization and quite a few other things), keeping the number of supported types down is much better than the converse - exposing the details of 16/32/64 bit numbers and their signedness will hang you over the long term, and you can always provide explicit conversion functions to/from Number for those who actually care.
> > 
> > String, Number, Boolean, Data, Date, Array and Dictionary are all plists support, and Apple developers have gotten along pretty well for many years with that set (not supporting Dictionaries, btw, is a pretty fundamental loss IMHO - it means you have to always iterate through lists to find your stuff, which is meh!).
> > 
> > When Apple extended the Plist metaphor for IPC (to create XPC), they also added out-of-band types like file and shared memory descriptors.  You have file descriptors, but not shared memory.  The latter is kind of important if you want to do larger IPCs with this mechanism someday and want to support "big payloads" transparently without passing the burden of the data management to the application programmer.
> > 
> > Before you also come back with "but but this is a kernel API!  For just one purpose!" let me just say that it's absolutely achievable to have ONE API for talking userland<->kernel and userland<->userland with the same types and the transport mechanism(s) largely abstracted away.  You don't need two - it's already been done with one, just look next door. :)
> > 
> > If you add file serialization of this format to your picture (and add the dictionary type) , bingo, now you have a preferences API that FreeBSD has lacked from day one ("just roll your own format and stick the file in /etc" being the canonical response to that need).
> 
> What about looking at NetBSD's libprop?

Someone already suggested that, but libprop is much much more complex
than libnv. I really want something extremely easy to use, so it can
be adopted quickly.

-- 
Pawel Jakub Dawidek                       http://www.wheelsystems.com
FreeBSD committer                         http://www.FreeBSD.org
Am I Evil? Yes, I Am!                     http://mobter.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-arch/attachments/20130726/cc48f4e2/attachment.sig>


More information about the freebsd-arch mailing list