From: Peter Bex <peter....@xs4all.nl> Subject: Re: [Chicken-hackers] [PATCH] Allow optional functor arguments Date: Sat, 12 Jul 2014 18:04:51 +0200
> On Mon, Jul 07, 2014 at 10:46:47PM +0200, Felix Winkelmann wrote: >> Hello! >> >> Here another (and proper) patch: it allows functor arguments to be >> optional, giving the author or a functor a way to provide a default, >> which seems to be quite useful. I think this patch was submitted >> before, but seems to have been forgotten. > > Hi Felix! > > Thanks for re-submitting it. I think it was only posted to our Trac > installation as #1121, but that doesn't matter much. > >> This patch also fixes a bug in the functor-argument matching code: >> when verifying whether a module given as argument exports the required >> binding, the export-list was previously checked (that's the list given >> in a module declaration, specifying the exports). But that was >> incorrect, as, for example, builtin modules (like "scheme") do not >> have export lists. This change uses the "vexports"/"sexports" lists >> of a module instead, that is, the "real" exports. > > Thanks again for the patch, I've pushed it and closed #1121. I've also > updated NEWS to mention the bugfix and new feature. I liked the fact > that you added some comments, they helped me to understand what the code > was doing more easily! > > I didn't fully grok the bugfix, so I wrote a simple test program to > verify that I understood what it was doing, but while this doesn't > fail as hard as before the patch, it's still not working. Could you > take a look at the attached file? > > I think this may actually indicate two bugs: the functor complains > about unbound identifiers, but if I compile the following simple > program: > > (use csi) > (toplevel-command 'blabla (lambda _ (print "blabla"))) > > I also get an error that "csi" can't be loaded. The functor needs to import "chicken" to detect the #!optional (i.e. extended lambda-lists - yes, the warning is misleading and doesn't give the "#!", don't ask me why, I don't know). It also needs to import "csi-like". And finally, use "import" for the "csi" module: : (import csi) (module foo-with-csi = (foo csi)) : felix _______________________________________________ Chicken-hackers mailing list Chicken-hackers@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-hackers