IRC channel logs

2021-01-12.log

back to list of logs

<wingo>so, weird thing -- call-with-input-file and call-with-output-file will close the port on normal return from the proc
<wingo>but the same procedures for strings won't
<wingo>i think that is probably just a bug.
<wingo>i even have a few call-with-output-string* definitions in guile that are there just to close the port
<leoprikler>IIRC none of those functions guarantee immediate closing, though, am I right?
<wingo>if the proc returns normally, call-with-*-file guarantees the port is closed
<wingo>from r5rs
<leoprikler>Ah, right, the guarantees just don't extend to non-local exits
<dsmith-work>UGT Greetings, Guilers
<surpador>Is there a way to cause Guile to enter a debugging REPL at a specific point in a script? Kind of like python's `pdb.set_trace`?
***rekado_ is now known as rekado
<rekado>surpador: in a REPL you can use ,break and ,break-at-source
<surpador>Ah ok. Is there no way to set a breakpoint in source without doing it from the REPL? I don't really have a use case in Scheme yet but I know with a Python project I was working on setting a breakpoint in source was nice since I wanted to break during execution of a much larger program of which the target file was one small part
<spk121>surpador: you could always at "(error)" where you want to break
<spk121>assuming you aren't catching errors
<mfg>Hi, i'm trying to invoke a (syntax-rules) macro like this: (my/macro (make-list 32 0)), i get that the macro literally works with "(make-list 32 0)". Is it possible to actually evaluate the make-list before the macro gets expanded?
<dsmith-work>mfg: You would need to do that in the macro I guess. Maybe your macro should really be a function?
<dsmith-work>The whole point of macros is that the args are NOT evaluated. So you can make new syntax.
<surpador>spk121: ah true, I could try something with that, maybe install whatever the repl uses as the exception handler or something
<manumanumanu>mfg: not with syntax-rules, unless you are hard-coding every case for make-list
<manumanumanu>((_ 3 val) '(val val val)) (_ 4 val) '(val val val val)) etc.
<manumanumanu>but with correct syntax
<manumanumanu>with syntax-case you can get the values of make-list if they are constants (or using syntax-local-binding (???) you can get values from other modules) and programmatically build the syntax object you want.
<mfg>dsmith-work: Makes sense. I'm just starting out with macros and know not much about them :D
<apteryx>is there a way to assert in Guile?
<mfg>manumanumanu: Hm, i will have to read the documentation about syntax-case :)
<ft>You can always do this: (define-syntax-rule (my-macro x) (let ((v x)) v)) -- which will make the value accessible as ā€˜vā€™ when the thing runs. But I agree, sounds like that thing doesn't have to be a macro.
<apteryx>silly me; there's 'assert'
<apteryx>it's in rnrs base
<mfg>but you are right, i shouldn't use macros for this :D
***amiloradovsky1 is now known as amiloradovsky
<manumanumanu>mfg: the best docs is the tspl4 (the r6rs part of the chez scheme manual) and "fear of macros" for racket.
<manumanumanu>fear of macros is incompatible enough for it to be a PITA.
<dsmith-work>sneek: macros?
<sneek>Last time I checked macros is http://hipster.home.xs4all.nl/lib/scheme/gauche/define-syntax-primer.txt
<dsmith-work>That is "JRM's Syntax-rules Primer for the Merely Eccentric"
<dsmith-work>sneek: botsnack
<sneek>:)
<mfg>Thank you for the links/tips :)
<sneek>sneek: later tell dsmith-work Hello
<dsmith-work>hmm
<sneek>Welcome back dsmith-work, you have 1 message!
<sneek>dsmith-work, dsmith-work says: Hello
<dsmith-work>Heh
<sneek>sneek: later tell sneek Testing
<dsmith-work>sneek: botsnack
<sneek>:)
<dsmith-work>heh. Nope.
<mwette>sneek: later tell surpador, It's been years since I tried to put together a guile version of pdb.set_trace() but look at this: https://paste.debian.net/1180849/ where usage is pdb.set_trace() => (jump-to-debugger)
<sneek>Got it.
<mwette>surpador: stripped down it's: (start-repl #:debug (make-debug (stack->vector (make-stack #t)) 0 "trap!" #t))
<mwette>
<surpador>mwette: ah nice, that makes sense, thanks! I'll have to play around with it a bit :)
<sneek>surpador, you have 1 message!
<sneek>surpador, mwette says: It's been years since I tried to put together a guile version of pdb.set_trace() but look at this: https://paste.debian.net/1180849/ where usage is pdb.set_trace() => (jump-to-debugger)
<dongcarl>Grateful if anyone can help with: https://gitlab.com/guile-git/guile-git/-/issues/22