<nilg>Any idea how to list all symbols in a module? <nilg>via the guile interactive shell... <ft>nilg: Something like this maybe? (map car (hash-map->list cons (module-obarray (resolve-interface '(srfi srfi-1))))) <nilg>oh, that's complicated I imagined something simpler like `,s module-name`, but it works, thanks. <amz31>massive number of commits incoming from wingo ***logicmoo is now known as dmiles
<manumanumanu>ArneBab: My for loops can finally do non-tco recursion! I have got some refactoring and tests to do, but other than that I am on my way to a stable release :D <manumanumanu>I have started writing the guest blog btw. the one on complex macros. <amz32>I see the database I've written could be useful in my day job; I will try to port it to python. <amz32>because it will be easier to adopt than change the world for a better guile place ***eponym is now known as epony
<manumanumanu>So: I have this problem: I have a list of symbols. I have a list of "valid symbols" in module 1. I want to make module 2 that will add symbols to that list, but in a way that module 3 can't see unless it imports module 2. <daviid>manumanumanu: so, how about module 2 imports module 1, re-export module 1 public interface, then export new valid symbols ... then module 3 will only see the newly added symbls if it imports modle 2 ... <manumanumanu>I have painted myself in a corner though... module1 defines macros that act on the valid-symbols <manumanumanu>Or rather, it has a procedure that checks whether a symbol used in a macro is valid <daviid>manumanumanu: it sounds like a can full of worms to me :), could you produce a snipset we could play with maybe (not that I'll be able to help, but ... <daviid>tbh, I don't understand what yu are trying to do :), sorry <manumanumanu>I have written a looping construct. In that module I have a list of "valid sequences" (like in-list, in-range, in-vector). Sequences are validated during macro expansion. I want modules to be able to define their own sequence types. <manumanumanu>In a way that doesn't add them globally. Currently I am using (add-sequence-type! 'symbol) that uses set! on a list <daviid>I don't see any other possibilities then effectively holding a list of (or what ever structure is adequate), that grows or shrinks ... what's wrong with that? <manumanumanu>Well: if module2 defines (in-bananas ...) and adds in-bananas to the valid sequences, it also becomes valid in module3 that hasn't imported module2 <manumanumanu>Not a huge deal, but still. I want to provide good error messages <daviid>but it adds to the valid module 2 lists, not the module 1 list, then module 3 will only see module 1 list <manumanumanu>oh, but the list is defined in module1 and the macros using that list is also in there, so module1 is not "importing" any valid-sequences list <daviid>manumanumanu: i don't see any other way then splitting that in two, and module 3 to check if it imported (or not) module 2, and 'adapt' its valid proc/macro depending on ... <daviid>or a hacky hack where module 1 would export its valid symbol lists length, module 2 would add at the end, module 23 would only be allowed a portion of that list ... fun games <daviid>fun and dangerous games :), but feasible I guess <manumanumanu>but I don't really see how to do that without re-exporting the macros. <manumanumanu>and that sort of defeats the purpose of a simple (define-sequence ...) macro. <manumanumanu>The whole thing is huge, with a gazillion helper functions and almost 1000 lines of code. <daviid>but the macro could be 'augmented' so it checks what I exposed above, no? <daviid>you mean tha macro that checks f a symbol is valid <daviid>would check what modules it is supposed to check against ... the macro would be the same for all <manumanumanu>daviid: I could create something like (export! valid-seqs) and somehow have the macros check the local environment <manumanumanu>But then we have the problem of conflicting valid-seq lists :( :( <manumanumanu>So, I will add (current-module) whenever someone adds a valid sequence, and then check the imported modules during macro expansion <manumanumanu>If I can in any way find out what modules are currently imported... <daviid>well, you could check for a name, like <daviid>if that variable is defined, then module 2 has been imported too <manumanumanu>I think actually checking the current modules is the way to go <daviid>ah yu found a better solution indeed <manumanumanu>daviid: thanks for the input. You made me go to places in the docs I never knew existed :D :D <daviid>in C, can't we do 'int foo (int a, b, c)' <daviid>i mean do we have to specify the type for arg individually <Combinatorialist>daviid: You might be able to use K&R style: int foo(a, b, c) int a, b, c; { return 0; }