IRC channel logs
2025-01-04.log
back to list of logs
<freakingpenguin>Is (ice-9 getopt-long) the recommended way to handle cli arguments or is there a more featureful alternative? e.g. formatting the help output. <freakingpenguin>rlb davidl: Thanks! I'm coming from Ruby's OptionParser which tidies up things like version/help logic for you, but seeing how Guile's getopt-long is used in a real project helps. <daviid>freakingpenguin: caution, guild (guile's main script so to speak) uses (basic use) getopt-long, but the compile (sub)script actually uses the srfi-37 - caution when you evaluate, those api's are diff <dthompson>I have used srfi-37 and optionparser years ago and I think srfi-37 is better <daviid>dthompson: probably, my experience is more out of 'sticking to what i was doing', so i'll trust your judgment <dthompson>I haven't used getopt-long in any serious capacity so no comment there <freakingpenguin>dthompson: Why the preference for srfi-37 over optionparser? Any chance you remember? <dthompson>optionparser was really procedural and kinda odd to me. srfi-37 is more declarative, functional <dthompson>I like how with srfi-37 I can just setup an alist of default options and then fold over what the user passes in <daviid>that's what the compile guild (sub)script does, fwiw - see parse-args i the script module def <daviid>anyway, good luck, back to hack ... <jason>anybody have a way for geiser to reload all guile modules within a path? <graywolf>Hello :) Would someone have an example of how to print a stack trace for an exeception inside the handler in with-exception-handler? I was not able to figure it out from the manual :/ <cow_2001>oh oops. someone on #scheme quoted the "Error situations and unspecified behavior" section and it specifically says it is allowed <elpogo>that same someone in #scheme also said that "(let ((x 2)) (letrec ((y x) (x 3)) (+ x y)))" should return 5 according to the rnrs specs, but in the guile repl it prints 6. <graywolf>elpogo: Hm. Do we have a bug report for that? <graywolf>However "should return 5" is also wrong. Honestly what chicken does (crash) is imho the correct way to process that expression. <mwette>Why? I'm seeing 5 as the right answer; sounds crazy to generate an error. <mwette>Oh, wait. Maybe it should be 6. Need to go back and read. <graywolf>So it seems this is an undefined behavior, so *any* answer is correct after all. <graywolf>Personally I would prefer to get an error, but meh <graywolf>Honestly I would not get that from our docs. <graywolf>> Note that while the init expressions may refer to the new variables, they may not access their values. <graywolf>I would understand that it as "would cause an error", not "undefined behavior" <graywolf>But yes, now that I know what to look for, I see it there. <elpogo>also, you will get an error if you use the guile interperter instead of the compiler <elpogo>graywolf: search on that page for "The behavior of the expression above is unspecified" <elpogo>the comment for the example in the letrec* section mentions the unspecified behavior of letrec <graywolf>Ugh, did not occur to me to look for it in an example for letrec*, I give you that <elpogo>yeah it tripped me up earlier when i was trying to find it (i knew i'd read it before, so i knew it was there somewhere) <elpogo>makes sense mwette . convert_assignment in libguile/expand.c does something similar and does raise an error. so does the eval.scm interpreter. only the compiler returns a value <mwette>I see now. The error is adding #f. I thought "error" before implied syntax error. <mwette>The letrec gives 6. But the equivalent form w/ let+set! gives an error. <jmes>I believe I've done this before but I can't remember how to do something like this: (define (symbol-append 'foo- 'bar) 'baz) <jmes>Context: writing a macro to define some functions, the names of which need to be generated <jmes>I get source expression failed to match any pattern in form ... <jmes>Specifically something like: <jmes>(define-syntax-rule (define-parser type) <jmes> (define ((symbol-append type '-parser) data) <jmes> (do-something-to-parse data)) <mwette>where tid is a syntax-object to use w/ datum->syntax; args can be string, symbol or identifier <jmes>mwette: Thanks, I'll digest that for a second 😅