[Gtk-sharp-list] Glib.Value?
Vladimir Vukicevic
vladimir@pobox.com
08 Oct 2002 17:32:01 -0700
On Tue, 2002-10-08 at 17:12, Miguel de Icaza wrote:
> Hey guys,
>
> I do not understand, why do we need to have Glib.Value? Cant we
> provide things to the underlying runtime under any format on demand?
>
> miguel
Well, in the case of setters, we could have instead of:
Object.SetProperty (string name, GLib.Value v);
a whole family of
SetProperty (string name, string s_val);
SetProperty (string name, int i_val);
etc.
This would probably be doable just by adding a metadata tag to generate
a "Value family" or somesuch for this argument.
For getters, the situation kind of sucks, because you don't necessarily
know the type of the value until you get it.. although it would be nice
to have:
GetProperty (string name, out string s_val);
GetProperty (string name, out int i_val);
etc. And maybe throw a type exception if the underlying glib type isn't
what is being requested? Should the code try to convert? (i.e. if the
underlying type is an int, and you want a string, ToString() it? or if
the reverse, try to parse it to an int?) I guess in practice you often
do know the type, so the errors wouldn't be that bad.
I'd still keep the current GLib.Value stuff around though and provide
these others as convenience wrappers though, for the (hypothetical) case
when you want to get a value from one place and set it elsewhere without
caring what type it is.
- Vlad
--
Vladimir Vukicevic <vladimir@pobox.com>