gEDA-dev: [RFC] Guile Fluids in gEDA
Steve Meier
smeier at alchemyresearch.com
Wed Jan 9 16:08:56 EST 2008
I tend to think of get and set as a pair so that if I have a methode
which returns some thing via a get I expect to have a methode that
allows me to set that thing.
lacking the get I tend to think I am creating a new instance as in C++
toplevel = s_toplevel() to me means create a new instance of a toplevel
to even avoid this ambiguity I often in a non-object oriented language
use function names such as
toplevel = s_toplevel_new(); to create a new instance
and
toplevel = s_toplevel_get_reference(toplevel); to give me a pointer to
the same thing I already have but to increment the reference count
within the structure so I don't destroy it until the last reference to
it is destroyed.
toplevel = s_toplevel_get_active() would return a pointer to the active
toplevel
s_toplevel_set_active(toplevel) would make the instance of the toplevel
the active instance.
Steve M.
On Wed, 2008-01-09 at 20:38 +0000, Peter TB Brett wrote:
> On Wednesday 09 January 2008 20:00:28 Steve Meier wrote:
> > Peter,
> >
> > In general it looks good.
> >
> > How about making the function
> >
> > /* Return the fluid containing the active TOPLEVEL */
> > SCM s_fluid_get_toplevel ();
> >
> > instead of
> >
> > /* Return the fluid containing the active TOPLEVEL */
> > SCM s_fluid_toplevel ();
> >
>
> Thanks -- that should have been g_fluid_toplevel() instead of
> g_fluid_toplevel.
>
> Normally, it's not useful to handle the fluid directly. The fluid isn't the
> TOPLEVEL -- it's an opaque Guile construct, which can give you a TOPLEVEL if
> you ask it nicely.
>
> You will notice that g_fluid_get_toplevel() returns a TOPLEVEL, as you'd
> expect.
>
> g_fluid_toplevel() is a sort of "singleton function". I gave it that name by
> thinking of it AS the fluid, rather than as a function which returns the
> fluid.
>
> Does that make sense?
>
> Peter
>
>
> _______________________________________________
> geda-dev mailing list
> geda-dev at moria.seul.org
> http://www.seul.org/cgi-bin/mailman/listinfo/geda-dev
More information about the geda-dev
mailing list