GNOME Bugzilla – Bug 492483
generic methods needed
Last modified: 2009-06-03 07:27:12 UTC
Hi, generic methods would be great to have, i.e. I write a function that operates on List<something> and can apply it to a List<anything>... Cheers, Xav
Confirming.
I'd be very interested in the being able to do the following: // retrieving gconf value var x_pos = settings.get<int> ("x_pos"); // some fictitious db api var title = row.get_column<string> ("title"); // For implementing an api, i wouldn't mind something like the following. public T get<T> (string param1) { var type = typeof (T); if (type == typeof (bool)) return true; else if (type == typeof (string)) return "value"; return null; } // Perhaps that could compile to something like .. public GValue some_type_get_as (GType type, string param1);
Rather, public GValue some_type_get_as (SomeType self, GType type, string param1);
commit 37c82ec971b2b200f3d7ca188d1c91d0f34a3f9f Author: Jürg Billeter <j@bitron.ch> Date: Tue Jun 2 17:26:29 2009 +0200 Add initial support for generic methods Fixes bug 492483.