GNOME Bugzilla – Bug 761517
Implement parameter prediction
Last modified: 2016-02-26 02:19:58 UTC
Created attachment 320389 [details] [review] WIP: argument prediction draft A simple example from gjs: let handler = function(server, msg, path, query, client) { msg.response_body.append('<html><body>Greetings, visitor from <br>What is your name?<form action="/hello"><input name="myname"></form></body></html>\n'); msg.status_code = 200; msg.response_headers.set_content_type('text/html', {}); }; let server = new Soup.Server({ port: 1080 }); server.add_handler('/', handler); server.run(); It uses libsoup to reply to http requests. The response-body-append method requires the buffer itself and the size of its buffer. Seed is able to use this as long as we also give to it the size of the string: msg.response_body.append("foobar", 7) Gjs can get that information from the array itself. So, this is what I'm proposing here in this draft patch: basically the same approach: get the buffer size from the array itself. A did run some smoke test on some examples and they didn't broke. But I would like to have a second opinion on it before writing a final version. (It's already on top of that reformat commit, not a big problem as it's simple and it's still a draft. If that one doesn't make to the tree, fixing this one is easy)
only comment is that normally the SeedException* is the last argument to most methods that pass it.. - might be worth 'trying' to keep that consistency? Otherwise looks fine. Regards Alan
Ok, hold this for a few days. I will come back to it next week.
Ok, so I did a few changes here: Basically the old version of the patch was breaking the old API. And I also implemented what you mentioned regarding the excpeptions... new patch in a few minutes...
Created attachment 321673 [details] [review] new patch new patch
want to apply the same logic to seed_gi_make_array_from_string - exception last arg..
(In reply to Alan Knowles from comment #5) > want to apply the same logic to seed_gi_make_array_from_string - exception > last arg.. Sorry, I missed that. Thanks for bringing it up. Sending a new version....
Created attachment 321959 [details] [review] patch v3
Committed