Sorry, wrong patch. Of course I'll want to actually revert the other
one ;)


On Tue, 2010-01-26 at 14:48 -0800, Evan Nemerson wrote:
> I just talked to Jürg in IRC, and he prefers the old version too, so
> it's going to get reverted.
> 
> Jiří, do you think the attached patch is sufficient for documentation?
> It just adds a link to l.g.o/Vala/MarkupSample, which we can change at
> will. I don't think we should put too much documentation in the vapi,
> but I like the idea of at least linking to a sample...
> 
> 
> -E
> 
> 
> 
> On Tue, 2010-01-26 at 23:28 +0100, Jiří Zárevúcky wrote:
> > Michael 'Mickey' Lauer píše v Út 26. 01. 2010 v 23:24 +0100:
> > > Am Dienstag, den 26.01.2010, 15:48 -0600 schrieb Sandino Flores Moreno:
> > > > The next URL has the testcase:
> > > > https://bugzilla.gnome.org/attachment.cgi?id=152347
> > > > 
> > > > It demonstrates that using methods as callbacks
> > > > with MarkupParser is possible without introducing
> > > > strange parameters neither restricting the methods to be static.
> > > > 
> > > > It's the same parser I had written in Genie, just simplified and
> > > > translated to vala.
> > > 
> > > Thanks for this example. This indeed convinces me to toss a vote for the
> > > revert -- sorry Jiří. In this case I prefer usability over theoretical
> > > correctness.
> > > 
> > 
> > Theoretical correctness aside, any other use case leads to broken C
> > code, which is far from my definition of usability. I have no problem
> > with the old way, *in case* it gets properly addressed in the
> > documentation *and* as a comment in the VAPI. There is nothing more
> > annoying that bindings that require undocumented magic to work. 
> > 
> 

>From 9a320a9a6d7b97c4205871ce80d8e4c6d1a377db Mon Sep 17 00:00:00 2001
From: Evan Nemerson <[email protected]>
Date: Tue, 26 Jan 2010 14:51:22 -0800
Subject: [PATCH] glib-2.0: revert previous patch against MarkupParser callbacks.

The new version sacrificed usability for theoretical correctness, and
was not well received.
---
 vapi/glib-2.0.vapi |   18 +++++++-----------
 1 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/vapi/glib-2.0.vapi b/vapi/glib-2.0.vapi
index d170aff..7083cbc 100644
--- a/vapi/glib-2.0.vapi
+++ b/vapi/glib-2.0.vapi
@@ -2830,7 +2830,8 @@ namespace GLib {
 		public string[] fetch_all ();
 	}
 
-	/* Simple XML Subset Parser */
+	/* Simple XML Subset Parser
+	   See http://live.gnome.org/Vala/MarkupSample for an example */
 
 	public errordomain MarkupError {
 		BAD_UTF8,
@@ -2860,20 +2861,15 @@ namespace GLib {
 		public void* pop ();
 	}
 	
-	[CCode (cname = "GCallback")]
-	public static delegate void MarkupParserStartElementFunc (MarkupParseContext context, string element_name, [CCode (array_length = false, array_null_terminated = true)] string[] attribute_names, [CCode (array_length = false, array_null_terminated = true)] string[] attribute_values, void* user_data) throws MarkupError;
+	public delegate void MarkupParserStartElementFunc (MarkupParseContext context, string element_name, [CCode (array_length = false, array_null_terminated = true)] string[] attribute_names, [CCode (array_length = false, array_null_terminated = true)] string[] attribute_values) throws MarkupError;
 	
-	[CCode (cname = "GCallback")]
-	public static delegate void MarkupParserEndElementFunc (MarkupParseContext context, string element_name, void* user_data) throws MarkupError;
+	public delegate void MarkupParserEndElementFunc (MarkupParseContext context, string element_name) throws MarkupError;
 	
-	[CCode (cname = "GCallback")]
-	public static delegate void MarkupParserTextFunc (MarkupParseContext context, string text, size_t text_len, void* user_data) throws MarkupError;
+	public delegate void MarkupParserTextFunc (MarkupParseContext context, string text, size_t text_len) throws MarkupError;
 	
-	[CCode (cname = "GCallback")]
-	public static delegate void MarkupParserPassthroughFunc (MarkupParseContext context, string passthrough_text, size_t text_len, void* user_data) throws MarkupError;
+	public delegate void MarkupParserPassthroughFunc (MarkupParseContext context, string passthrough_text, size_t text_len) throws MarkupError;
 	
-	[CCode (cname = "GCallback")]
-	public static delegate void MarkupParserErrorFunc (MarkupParseContext context, Error error, void* user_data);
+	public delegate void MarkupParserErrorFunc (MarkupParseContext context, Error error);
 	
 	public struct MarkupParser {
 		public unowned MarkupParserStartElementFunc start_element;
-- 
1.6.6

_______________________________________________
Vala-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to