<Zelphir>Finally managed to implement the contract macro also for cases with . rest arguments. And added tests! :D They proved very helpful once again, when editing around in the macros. <Zelphir>I guess next level would be to allow definition of contracts outside of the (define ...) form. But I also guess, in that case I would have to work with module stuff inside the macro. <old>Zelphir: Can you share a paste of your solution? <stis>Zelphir: FYI I actualy implemented a good part of the contract functionality in racket in guile. I'm sure it has bitrotted like a good wine ;-) <flatwhatson>Zelphir: these contracts, is it something like function prototypes or declarative type constraints? <stis>yeah If you want to know about it, consider the racket docs <stis>Zelphir: ^^ is that a correct or do you ocnsider a different variant? <stis>the old stuff are 10 years old. <Zelphir>Yes, Racket has it already built in as a #lang I think. Used that before at some point. <Zelphir>I've written a new one, Stis. Mostly got inspired by some blog post saying, that the author wishes some programming language took contracts serious and had good implementation for them. So I thought: "I could try that as a macro!" <Zelphir>And tbh, I was not aware of the old guile-contract thingy. But maybe a look at it wouldn't hurt for info how to implement on the module level. <Zelphir>Also I think my implementation might be naive. Not sure. Was difficult enough to get it this far :D Still learning about macro stuff. <Zelphir>Also I used CK macro, because with normal macro, I had issues, when a form expanded into a (lambda ...), because lambda is a macro and would get expanded there, but I still needed to expand the arguments of it first (like in normal Scheme). So it got too complicated and I remembered reading about more composable macros called CK macros. <Zelphir>I quite like how the CK macros turned out to work, actually. <Zelphir>Way less complicated to use and manage arguments of things. <stis>yeah, rthe ck macros are both fun and powerful, like them a lot <stis>it's included in standard guile libs <Zelphir>So no need for me to put it in my repo. But maybe it helps for understanding? <stis>If I rememer correctly the my old lib is functional <stis>yeah it's one if the gems in shceme land <Zelphir>I think Chicken Scheme also has them. <stis>(use-modules (system base ck)) <Zelphir>OK I will consider switching to that. I feel like including them in the repo and trying to annotate what is going on was part of the learning process, so I might keep that, but maybe separate it out and use the Guile built-in. But then my example would not work for other Schemes any longer. But also it is guile-examples repo ... unsure. <stis>it's a small lib, having int as a src is not bad as well, but now readers of this channel can emmediately start playing with it <Zelphir>Yep, I think that is, where I first saw them. <Zelphir>I quite like the Chicken Scheme docs. <stis>we should have docs or links do docs for the guile lib as well in my opinion. Right now it is a well kept secrete <Zelphir>When I search for `guile +"(system base ck)"`, the Guile manual does not show up in search results ^^' <stis>it's a library of modules (lib) <jab>stis: doesn't the guile manual talk about those? <stis>./module/system/base/ck.scm <Zelphir>The manual might not have a page about it, or the search engine tries to be too clever and avoids finding it ;) <stis>cheme@(guile-user)> (use-modules (system base ck)) <stis>so guile finds the module <stis>no there is no doc about it which is a pity <Zelphir>Yes, I meant the web search, for people who look for CK in Guile. <Zelphir>I think linking to Oleg's page would also not be too bad, as a start. <stis>ask for an update of the guile docs, maybe file a bug report? <Zelphir>I do not claim though, to fully understand the core (ck () ...) macro. I think I've once tried to understand all cases it has, but at least one case I did not understand. <stis>I think that it is a tre unwinder which make sure to execute the macros in application order <Zelphir>It is definitely about the application order, but how it does that exactly in the detail ... Maybe some day I will get it. <stis>yeah macros are mind wrangling. I first did everything with syntax-rules and then learned to love syntax-case <haugh>Maybe a fever dream but didn't Wingo write about how prompts were supposed to supersede CPS styled macros <Zelphir>I remember seeing a video of a presentation, in which he said, that prompts are very powerful, but I probably did not understand it all. <haugh>Not claiming to understand either, haha, just maybe an explanation of why syntax-case is doc'd and ck isnt <stis>prompts are neat, I just whish that we had one shot versions of them in the guile then some of the overhead could be mitigated in many use cases <stis>haugh: ck macros are very powerful if you want to do macro expansion like evaluating functions e.g. <stis>with ck, in (a (b c) (d e)) (b c) and (d e) is expanded first, in syntax-case and syntax-rules (a ...) is expanded first <stis>so while some of the pain is gone using syntax-case like parsing the syntax tree in a sane way, some application needs the other way of expanding <stis>I'v used ck macros to make macros that processes sub languages and where the user expect that the (ideoms is expanded in applicative (ck like) order <stis>especially if you want the user to extend this sub langauge through custom constructions you can benifit from the ck approach <stis>An example is macros definer that allows custom higher order patterns to be defined for other patterns and data for a matcher very much like (ice-9 match) <stis>applicative order means that all arguments is constructed with the same standard set of atoms as all custom macros in the subexpressions has been expanded <stis>which can be a neat thing to have with ck macros as you still maintain hygiene and get's stuff for free <allana>Hi #guile! I have a question about the guile repl that I have so far not been able to find an answer on my own. Say that I am using a 3rd party module and I want to call a procedure form that module. How can I know in advance the arguments that it accepts? <flatwhatson>allana: if it's properly documented, you can get docs in the repl: ,d somefunc <allana>Thanks, I thought that would be it. In my case, with gnutls, all I get is #f for every procedure <flatwhatson>you might be able to print the procedure object for more clues <flatwhatson>ie. at the repl, just name the function instead of calling it: somefunc <flatwhatson>the printer for the procedure object might show argument names <flatwhatson>for gnutls, it installs an info manual which is probably the best place to work from <allana>Thanks flatwhatson. Also, perhaps related, when I try to list current bindings (,b) when gnutls is the current module, the guile repl lists several bindings before segfaulting. Not sure if that is a guile bug or not. Would this be considered a guile bug? I would be happy to post a bug report! <Zelphir>Seems to be a Lets Encrypt cert, so someone should probably hit the auto renew somewhere. <civodul>i don't know why auto-renewal didn't fire <civodul>or rather nginx didn't load the new certs <civodul>i guess i won't have my degree in certbot renewal <Zelphir>I had a similar case in a project once. The issue there was, that the owner of the certs was something that nginx was not allowed to access, but nginx would also not complain or stop working, so it went unnoticed. <Zelphir>The other thing was, that one needs to trigger an nginx -s reload, I believe. <civodul>right, "nginx -s reload" should do the trick <civodul>we have a certbot renewal hook that's supposed to do that, but apparently it's not doing it <Zelphir>I think in the end I used some inotifywait or so, to react to changes of the cert file and run the reload. <Zelphir>civodul: eh, now it is expired again o.o <Zelphir>Might have been some cache on my end. <Zelphir>Reloaded the page with disabled cache and then it worked. <antipode>allana: I noticed that segfault before but I don't remember the results of investigating and whether it was a Guile or GNUtls bug. <antipode>Was some GnuTLS bug IIRC involving printing its stuff (but only unexported things IIRC), maybe something like a null pointer dereference <antipode>haugh: Prompts were for replacing CPS-styled procedures, not for CK macros -- prompts are independent of the syntax things. <allana>antipode: Thanks for the feedback. I'm very much a guile scheme beginner so it's a bit of a challenge for me to understand where the bug is. <antipode>If you would like to debug it, I recommend running under 'gdb'. <antipode>There was something happening on the C side IIRC <old>sneek: where is your source code <old>meeh. Anyone know where I can find sneek's source code? <old>Okay. Will grep the log whenever the certificate issue is solved <dsmith-work>Note that it's not really ready for general use. That's just a snaphot <old>Yes but the base are there <old>Would be possible to make a more generic bot that is configurable from that <old>eh it's based on bobotpp that is in C? <old>I though it would have used guile-irc ***justache is now known as justHaunted
<stis>FYI I have a cool replacement of guile's write function can be extreamly fast and behave better both as a serilazer and together with fibers. <stis>The scheme serialisation is chunked and each chunk goes to a c-stub that can take advantage of SIMD instructions. <stis>Some things are of the order of 100X faster than current guile's write/display <stis>this means that you get both C-speed, scm magic and non stalling c-calls with fibers <stis>which means that if one fiber is writing a GB scm object to file other fibers will not notice <stis>(use-modules (ice-9 write)) <stis>and you have write,display redefined to use this version in stead <stis>There is an issue though what good is it to be able to write fast if read is much slower!! <daviid>lloda: i see 'Provide a hook for the exception printer' wip-exception-truncate chnged the 13th, was this just to 'rebase' or some news? <daviid>Djurfeldt as well (who's using guile-cv), and none of us ever reported a problem 'becuse of the patch' ... <stis>manged to fully customize the printer output (remove $1 $2 ...) ^^ <daviid>stis: repl printers are easy to customize, we are talking about raised exception printers here <stis>daviid: the value yes, but not removing $1, $2 etc if I understand it correctly also my post was independet of your post <stis>but thanks anyway, I will add those links to the post <daviid>I hope lloda's paqtch to be merge - it is a zero 'no harm' patch - then customization of the reaised exception printers also becomes easy, and could be done even by a guile beginner ... <stis>The fun thing with terminals are that many terminals out there understands escape sequences and one can simply erase $1 $2 etc <daviid>no hack would be necessary if we patch guile with 5 to 10y old lloda's patch <stis>reworked the stack overflow post now, thanks to daviid: the code is much easier and a little less hacky <stis>But yes a proper customization is much much better to be preferred <daviid>if our maintainers accept to apply the patch, everything is solved