This helps a great deal, thank you for taking the time to
| If you want the objects to be used from all versions of the VB family, you
| have to implement IDispatch.
Ok. So you would delegate all COM support (IDispach) to
a wrapper... this gives credit to adding another target
language to SWIG (IDispatch).
| The API looks like a fairly typical C API. If you want people
| to actually use libyaml, this is the approach you should take.
Ok. I have two questions in this regard.
1. How do you do exception handling. There are three
approaches that I am aware of.
A. Have each function return an HRESULT that
should be checked, provide nice macros to
do this checking. Output parameters are
done via pointer. This solution is
reliable, but very cumbersome.
B. Use a global variable approach, aka errno,
and to keep it thread safe, make it a function
so that internally thread local storage can
be used. Problem here is most programmers
don't check errno; or it results in almost
twice as many function calls.
C. Use a "connect" struct which is passed around
in addition to the formal parameters. The
connect struct can contain the current result
code, error numbers, and other parser specific
If COM compliance isn't required, then option C
seems the best as it addresses error handling
as a class of problems, not singular.
2. How do you handle interfaces? I'd like to
specify YAML API as an interface, not as a
bunch of function calls so that various
implementations can dynamically be peiced
together in a processor pipeline.
A. You provide for objects, where the
first item in the struct is a vtbl
of functions relevant to that struct.
(think SAX interface, via callbacks)
B. You pass around vtables directly.
C. You provide first class functions
(for the parser and emitter),
but also have the interfaces (A)
for those who want to build
I'm thinking C, but don't have any other
3. How do you handle memory managment?
A. Go with reference counting,
(aka addref, release).
B. Rely upon garbage collection, which
is actually almost feisable...
C. Be a bit more novel... ?
I think that A is the option.
What would your preference be? 1C, 2C, 3A?
Thank you so much Jason.