IRC channel logs

2020-11-03.log

back to list of logs

*chrislck_ in admiration of macro hackers
***chrislck_ is now known as chrislck
<ArneBab>"goof-loop" — nice! :-)
<elliotpotts>is there a c equivalent of `lambda`? I asked the other day about a userdata
<sneek>Welcome back elliotpotts, you have 1 message!
<sneek>elliotpotts, str1ngs says: . Hello, you can also catch error/exceptions with C. see https://www.gnu.org/software/guile/manual/html_node/Exceptions-and-C.html
<elliotpotts>I'm solving my lambda problem in a rather horrible way:
<elliotpotts>scm_c_eval_string(format("(define foo (lambda args (dispatch (make-pointer {}) args)))").c_str())
<elliotpotts>essentially serialising my captures to scheme terms
<elliotpotts>sneek: thanks, I did see that page, it sounds like it's outdated? if it's not, I guess I'll use that
<leoprikler>if this is C++, why not use C++ lambdas?
<catonano>lloda: did you find anything about filename completions in the REPL ?
<lloda>catonano: no... I didn't configure anything, and i haven't had time to really look into it. I've seen https://www.gnu.org/software/guile/manual/html_node/Readline-Functions.html but i haven't touched any of that in my config
<lloda>it's nice to have filename completions inside a (load "... form
<lloda>but having them everywhere, it's very annoying
<catonano>lloda: well I'm interested in the issue. Should you find anything, I'd appreciate if you would share it
<lloda>I will
<catonano>lloda: thanks
<lloda>otherwise it bothers me that (let () (define a 0) a) is ok but (when #f (define a 0) a) is an error :-\
<lloda>ok, i can see why that is
<lloda>still
<ArneBab>lloda: that bothers me, too. it’s no longer as bad as before Guile 3 (you can now do (define (foo)(define a 5)(write a) (define b 6) b) ), but it still feels not-so-nice that I sometimes have to explicitly start a let-scope
<ArneBab>(when #f (define a 0) a) ;; fails
<ArneBab>(when #f (let ()(define a 0) a)) ;; works
<ArneBab>so the let in when should be implicit if there’s a define
<ArneBab>It’s also strange that this does not work: (when #f (begin (define a 0) a))
<ArneBab>Are there compiler-theory reasons for that, or is it just simplicity?
<elliotpotts>leoprikler: the problem is it's difficult to register them as scheme functions
<elliotpotts>since they cannot be cast to function pointers
<leoprikler>Neither can std::function, I assume?
<leoprikler>ArneBab: (when #f x) is already short for (if #f (begin x)), is it not?
<lloda>imo it's kinda wack that (begin (define a 0) a) is ok, but (if #f (begin (define a) a)) is not
<lloda>sorry (define a 0) ofc
<lloda>altho thinking about it it seems unavoidable. Sometimes you need to group and not scope
<lloda>would be easier if these two were one and the same
<ArneBab>leoprikler: hm, yes
<ArneBab>begin just pulls the code back into the outer scope, AFIK
<ArneBab>AFAIK
<leoprikler>I'm not completely sure about that either
<leoprikler>I think part of it is, that "if" bodies are no longer seen as top levels
<leoprikler>otherwise (when feature (define-public (yay) 'yay)) would make sense
<leoprikler>but it seems you need cond-expand for that
<topoi>I'm using OpenBSD as enddevice and suddenly (since 6.8?) my dhclient doesn't seem to get an IP from a specific router. The non-OpenBSD devices I'm using still get their IP's. Any Idea?
<topoi>Sorry. Wrong channel. =3
<elliotpotts>leoprikler: correct, they can't
<manumanumanu>chrislck: don't you like Continuation-passing syntax-rules macros? :D :D
<manumanumanu>I didn't make that shit up, though. Alex Shinn has been the source of almost all my WTF-syntax-rules?! moments...
<dsmith-work>UGT Greetings, Guilers
<elliotpotts>so, I'm still quite confused about exception handlers
<elliotpotts>if I'm implementing what amounts to a REPL, I need to:
<elliotpotts>1. take user input
<elliotpotts>2. read it
<elliotpotts>3. evaluate it
<elliotpotts>for 2, I can use scm_read, but how to I catch exceptions raised during this?
<dsmith-work>Need to call things within the context of an exception handler. https://www.gnu.org/software/guile/manual/html_node/Catching-Exceptions.html
<dustyweb>huh
<dustyweb>nomad is impressive
<dustyweb>also I didn't know about emacsy.
<dustyweb>seems useful
<civodul>yeah both are pretty cool!
<roelj>Is there something link valgrind for Guile? I'd like to see why my program's memory slightly expands as days pass by.
<civodul>roelj: there's no heap profiler, but there's 'gcprof', an allocation profiler
<civodul>it can give you hints as to what's leaking
<roelj>civodul: Alright, can I log the output of gcprof to a file?
<roelj>Oh, I can just pass #:port. That doesn't seem to be documented in the manual.
<roelj>civodul: Thanks! I think I've got it now. It'll take a few days before I know whether this gave me the information I was looking for :)
<civodul>roelj: maybe you can stress your program so it consumes memory more quickly
<roelj>civodul: Trying indeed. I do get a lot of ";;; (what! #<stack 7f1bb3895600>)", and "anon #x17bc1a8" in the summary table..
<civodul>hmm