IRC channel logs
2014-10-03.log
back to list of logs
<davexunit>I asked this question last night and I'm asking again because I'm too lazy to just mail the list right now: is it bad practice to export record type identifiers e.g. <foo> in modules? <davexunit>from reading other guile code, I see that they are typically not exported. however, when they are exported it allows the user to destructure that type with 'match'. <mark_weaver>davexunit: I think it's okay, but just beware that you are effectively making the specific order of the slots part of your API when you allow users to destructure your records with 'match'. (language tree-il) is an example of a guile module that exports the record type identifiers, fwiw. <mark_weaver>okay. you should still be able to add more slots to the end, if needed. <davexunit>the slots won't change. it's a euclidian vector math module for 2d, 3d, and 4d vectors. <mark_weaver>oh yeah, it's very reasonable to make those record layouts part of your API, indeed. <davexunit>thanks for confirming that it's an okay idea. :) <mark_weaver>rlb: you should cherry-pick 1baa2159307c34683e8ede54f38f65010fc594b0 into debian, I think. nasty memory corruption bug in get-bytevector-n. <mark_weaver>well, really the bug is in scm_c_shrink_bytevector, which is itself an API function, but 'get-bytevector-n' uses it. <mark_weaver>well, I can see some others such as 8442211. I should look through the commits and give you a complete list of suggested commits to cherry-pick. <rlb>mark_weaver: by all means -- if you like -- we have about 20 days (or less) before the freeze deadline (need 10 days to migrate from unstable to testing) <mark_weaver>rlb: okay, thanks. there aren't that many commits since 2.0.11, so it's not a big job. <mark_weaver>rlb: can you remind me where I can find the current set of patches for Debian's Guile 2.0.11 package? <nalaginrut>well, seems several commits appear in master, nice~ <lloda>would be nice to have (exact n) <lloda>alias for (inexact->exact n), but it's clear that n can be either <lloda>either exact or inexact I mean <trashbird1240>I'm trying to translate from a list of symbols to strings, modify those strings to get a list of procedure names and then get procedure information <trashbird1240>I have a list of options in an option-spec and I take the car, then map symbol->string across the result <trashbird1240>Now I have a list of the names of procedures used to access those options <trashbird1240>Then I want to get the docstrings from them using `procedure-documentation' <mark_weaver>to get the module object from the module name, use 'resolve-module' <trashbird1240>mark_weaver: okay, if I use (module-variable (current-module) 'get-mean) then it returns the variable <trashbird1240>but it appears I can't use that directly with procedure-documentation <trashbird1240>This works : (procedure-documentation (variable-ref (module-variable (current-module) (string->symbol "get-mean")))) <mark_weaver>trashbird1240: right, or you can just do (procedure-documentation (module-ref (current-module) (string->symbol "get-mean"))) <mark_weaver>btw, there's also 'symbol-append' to append symbols directly, e.g. (symbol-append 'get- 'mean) => 'get-mean <mark_weaver>(it works by converting to strings, appending, and then converting back, but it might make your code look a bit nicer) <paroneayea>what does "a ``field '' of an object" in relation to (match) mean? does that include goops fields? <davexunit>(define-record-type <foo> (make-foo bar) foo? (bar foo-bar)) ;; bar is a field <davexunit>I actually don't know how it works with GOOPS <davexunit>not sure if a GOOPS object can be destructured with match, but maybe? <taylanub>actually I think for any (foo x) => y, y is the foo field of x. <taylanub>that's why it uses the scare quotes around ``field'' in the documentation I think <taylanub>davexunit: well it works with record field accessors too of course, just much more generalized <davexunit>should've used a built-in procedure, oops. :) *tadni totally forgot Emacsy was a thing, till like 10 minutes ago. <tadni>davexunit: Yeah, some weird design choices to. Literate programming via noweb is a bit odd. <tadni>Still might be fun to play with a bit. :^P <paroneayea>I still don't understand it totally yet... I need to play with it more. <davexunit>it means that you aren't binding a variable for that matched item <davexunit>a 2 element list is matched, but only the first element is bound to a variable <davexunit>the presence of the element is important, but it's value is not. <davexunit>so you'll see match forms with a final case like: (_ (lol-idunno)) <paroneayea>I was reading some other docs, forgot for a small moment about this window, and literally lol'ed at lol-idunno :) <davexunit>sometimes I use it to display a more specific error message so the user doesn't see the standard match error. <dca>can i haz multiple guile instances in my C program ? <dca>dsmith-work: but i can run my different functions with scm_with_guile and each time the function will be computed in fresh environment?