After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 615040 - Add support for generic delegates
Add support for generic delegates
Status: RESOLVED DUPLICATE of bug 592993
Product: vala
Classification: Core
Component: Delegates
unspecified
Other Linux
: Normal enhancement
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2010-04-07 09:07 UTC by Sebastian Dröge (slomo)
Modified: 2010-10-17 22:23 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Sebastian Dröge (slomo) 2010-04-07 09:07:50 UTC
Code like this should work in the future (also with simple generics):


using GLib;

delegate void Foo<G> (G x);

private void foo<G> (G x) {
  string? xx = (string?) x;
  stdout.printf ("%s\n", xx.to_string ());
}

static int main(string[] args) {
    Foo<string?> f = foo<string?>;
    f ("123");
    
    return 0;
}
Comment 1 Sebastian Dröge (slomo) 2010-04-08 09:16:12 UTC
Assignments between variables of type delegate void A<T>(T x) and delegate void B (string x) should also be possible if T==string, same if B is a method of that type.
Comment 2 Maciej (Matthew) Piechotka 2010-10-17 22:23:55 UTC
Thanks for taking the time to report this bug.
This particular bug has already been reported into our bug tracking system, but we are happy to tell you that the problem has already been fixed. It should be solved in the next software version. You may want to check for a software upgrade.

*** This bug has been marked as a duplicate of bug 592993 ***