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 552961 - remove this parameter from methods
remove this parameter from methods
Status: RESOLVED FIXED
Product: gobject-introspection
Classification: Platform
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gobject-introspection Maintainer(s)
gobject-introspection Maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2008-09-20 00:19 UTC by Colin Walters
Modified: 2015-02-07 16:45 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
remove "this" parameter for methods (4.88 KB, patch)
2008-09-20 00:19 UTC, Colin Walters
none Details | Review
update to make g_function_info_invoke work (9.64 KB, patch)
2008-09-26 22:14 UTC, Colin Walters
none Details | Review
patch for pybank (3.88 KB, patch)
2008-09-26 22:16 UTC, Colin Walters
none Details | Review

Description Colin Walters 2008-09-20 00:19:20 UTC
Hi, I was looking at adding the "this" to signal GIR, but really I don't see the use - it seems redundant and makes more sense to instead remove it from methods.
Comment 1 Colin Walters 2008-09-20 00:19:48 UTC
Created attachment 119024 [details] [review]
remove "this" parameter for methods
Comment 2 Johan (not receiving bugmail) Dahlin 2008-09-23 18:02:16 UTC
There's plenty of re(In reply to comment #0)
> Hi, I was looking at adding the "this" to signal GIR, but really I don't see
> the use - it seems redundant and makes more sense to instead remove it from
> methods.

There's plenty of redundant information in the GIR available today.
I looked into removing the this parameter earlier, but I decided against it since it was actually making the bindings harder to write in pybank.

I'm not against removing it per see, I just know that it'll make some bindings harder and others easier.
Comment 3 Colin Walters 2008-09-23 18:53:32 UTC
I'll be on the hook to make the corresponding changes for girepository/pybank.  

Comment 4 Colin Walters 2008-09-26 22:14:11 UTC
Created attachment 119450 [details] [review]
update to make g_function_info_invoke work
Comment 5 Colin Walters 2008-09-26 22:16:13 UTC
Created attachment 119451 [details] [review]
patch for pybank

After making this patch I'm increasingly feeling it makes sense to remove g_function_info_invoke and have pybank do the invocations directly.  There's a lot of overhead in the current approach, and it will just be easier to handle the logic entirely inside pybank when we want to do more complex things like the array+length handling etc.
Comment 6 Havoc Pennington 2008-10-02 12:54:58 UTC
Comment on attachment 119450 [details] [review]
update to make g_function_info_invoke work

Unrelated thing I noticed, this would be a good place to use g_alloca:
  atypes = g_new (ffi_type*, n_invoke_args);
  args =  g_new (gpointer, n_invoke_args);

I don't think this error is clear if someone isn't looking at the source for the function:
+		       "Too few \"in\" arguments (handling this)");

Maybe "Invoking a method, no args were passed in, at least a 'this' arg is required" or something.

For all the "too few args" messages, including the expected number would be helpful.

Patch seems like a good idea to me overall.
Comment 7 Johan (not receiving bugmail) Dahlin 2008-10-02 18:21:36 UTC
Havoc: compare with bug 401080, the code there is similar and uses g_alloca as well.

(In reply to comment #5)
> Created an attachment (id=119451) [edit]
> patch for pybank
> 
> After making this patch I'm increasingly feeling it makes sense to remove
> g_function_info_invoke and have pybank do the invocations directly.  There's a
> lot of overhead in the current approach, and it will just be easier to handle
> the logic entirely inside pybank when we want to do more complex things like
> the array+length handling etc.

Looks good, and I agree that generally it'll be a good idea to let pybank do the complete invocation itself and convert between PyTypeObject and ffi types directly.
Comment 8 Colin Walters 2008-10-02 21:26:00 UTC
Ok, merged.  I updated the patch to use g_alloca similar to bug 401080.

r647 = 589426a456c52eafbb8a52ff02a27e5435d183d9 (git-svn)
r648 = c030fed7c1e46efe304d83740c5d8f15e9785859 (git-svn)
r649 = 27c84d4fb215dd17de91cd11c3be2d0ff32801c3 (git-svn)
Comment 9 André Klapper 2015-02-07 16:45:20 UTC
[Mass-moving gobject-introspection tickets to its own Bugzilla product - see bug 708029. Mass-filter your bugmail for this message: introspection20150207 ]