[LV2] Thoughts on a clearer atom forge API

David Robillard d at drobilla.net
Sun Jan 12 15:25:01 PST 2014


Despite my best efforts, atoms confuse a lot of people.  It seems the
forge is a large cause of this.  I thought it was quite elegantly
simple, so clearly I'm not equipped to guess what people will actually
understand.

So, I would like to have a thread of pie in the sky API wishes, which we
can cull into actually viable options.  The main restriction, of course,
is that allocating stuff all over the place can't happen: it must be
append-only.

One improvement, I think, would be to have the frame-creating calls
return a frame.  In a hypothetical C++ wrapper, to build the object

[]
    a my:Message ;
    rdfs:label "A wild message appears!" ;
    my:intensity 9000 .

this would get you something like:

frame = forge.object(uris.my_Message);
frame.key(uris.rdfs_label);
frame.string("A wild message appears!");
frame.key(uris.my_intensity)
frame.value(9000)
frame.end();

which, using method chaining, could be reduced to:

forge.object(uris.my_Message)
    .key(uris.rdfs_label)
    .string("A wild message appears!")
    .key(uris.my_intensity)
    .value(9000)
    .end();

Other contains would work similarly.

That's my best proposal so far.  Do better.

-- 
dr



More information about the Devel mailing list