IRC channel logs

2017-07-19.log

back to list of logs

<ster>Hello, what is the status of ECMAScript support in GNU Guile at the moment? I could only find this: https://www.gnu.org/software/guile/manual/html_node/ECMAScript.html, which is fairly ambiguous in many ways. Is it usable? Any other documentation I could take a look at?
<z0d>is I do scm_c_eval_string("(+ 1 2)") from C, how can I get the value out of the SCM object it returns?
<z0d>s/is/if/
<janneke>z0d: something like if (scm_is_integer (o)) i = scm_to_int (o);
<janneke>
<z0d>and SCM is a pointer, right?
<janneke>z0d: iirc, you can choose -- why do you ask?
<z0d>well, I'm doing a rather silly thing. I try to use libguile.so from bash. there's a project, which makes it possible to call C functions from bash. https://github.com/taviso/ctypes.sh/
<z0d>e.g. http://paste.lisp.org/display/351208
<z0d>this works fine
<z0d>and prints Guile's version inside bash
<z0d>but, dlcall -n buffer -r pointer scm_c_eval_string "(+ 3 4)" segfaults for some reason
<janneke>z0d: cool; a friend of mine has created a guile PEG for simple bash syntax with variables and job control, pipes
<janneke>i don't know why one would work and the other segfaults
<lloda>SCM may contain a pointer, but it's not a pointer. See libguile/tags.h in the source. For small integers the SCM holds the number itself.
<manumanumanu>Good day guilers!
<manumanumanu>I am getting a "syntax-case: misplaced ellipsis in form" error, but I can't for the world guess why
<manumanumanu>and I am pretty sure it is correct
<janneke>manumanumanu: in that case, you may need to teach the computer that it's correct
<manumanumanu>janneke: oh yes! The problem seems to be that I can't have two ellipsised patterns after eachother
<manumanumanu>((kw arg) ... rest ...)
<manumanumanu>which i find odd, since rest would be the other option not following the (kw arg) form
<manumanumanu>and (kw arg) ... . rest works, but doesn't match (kw arg)
<manumanumanu>it is such a sad thing that I don't know macros
<manumanumanu>hmmm. you can't have two ellipsised patterns follow eachother?
<manumanumanu>Alright, I'll write a helper macro.
<manumanumanu>I should probably do what stis is doing and use syntax-parse.
<faalentijn>I'm going to be a tad annoying and ask the same question again but does anyone have any idea why http-post throws a "The TLS connection was non-properly emrinated." gnutls-error when trying to send a body to a TLS website?
<amz3>I had the same issue previously
<amz3>I mean I tried to http-get something and I had the same issue
<amz3>just a few days ago using guix 2.2.2
<amz3>guile 2.2.2
<faalentijn>Okay so it is not me being stupid (always a chance when you're a beginner)? Was it also while trying to read out the response to a request to a website that only accepts SSL/TLS?
<amz3>no, it was against gnu.org
<amz3> http://gnu.org does redirect to https://gnu.org
<amz3>also I don't remember which version it was but http-get used to work with https for sure
<faalentijn>I noticed that the message was sent just fine, that it sparingly works when it accepts both but panics when it is either SSL only or redirects.
<faalentijn>I've no issues with doing a simple (http-get website) or even (http-get website #:body "") but it panics when trying to do (http-get website #:body "test").
<faalentijn> http://paste.lisp.org/display/350675
<amz3>faalentijn: btw you can use 'pk' instead of 'display'
<faalentijn>Oh really? Cool thanks.
<amz3>faalentijn: there is 'utf8->string' procedure in (rnrs bytevectors)
<faalentijn>Thanks, will keep that in mind for the future
<amz3>and welcome :)
<faalentijn>So, I guess that I will need to file a bug since it is not me being a dunce?
<amz3>yes
<faalentijn>I'll do so but it does sound rather terrifying to me
<amz3>actually that https support is recent
<amz3>in guile
<amz3>maybe it explains
<amz3>in the meantime, you try to downgrade to 2.2.0 maybe
<faalentijn>Seems to yeah, I tried to check whether 2.0 worked just in case it was a recent regression but it didn't support TLS at all.
<amz3>2.2.0 has TLS support but it has a bug with small payloads
<faalentijn>Does 2.2.0 work or do I need to first wrap it for GnuTLS myself? I know guile-oauth does the wrapping itself because I tried to look for examples.
<amz3>it can not read reponse body that are smaller than the system page or something like that
<amz3>faalentijn: the fool proof work around is to use guile-curl I guess
<amz3>which is supposed to work with both guile 2.0 and guile 2.2...
<amz3>and the maintainer is around sometime
<amz3>and responsive
<amz3>over github
<faalentijn>I can try doing that but I've always been averse to using things that aren't in the standard library unless I really need to. Got a bit of that Python/javascript trauma where everything is a library.
<amz3>my day job involves both python and javascript
<amz3>I don't blame them, i just prefer guile but to be honest I wish there were more libs in guile
<faalentijn>I like Python and javascript it is more that I'm afraid of becoming a left-pad programmer
<amz3>:)
<amz3>btw leftpad was added to ES2017 or ES2018 as a standard string method
<faalentijn>Of course it would be nice if there were more libraries but there should be a happy medium between the standard library and external libraries. You want libraries to actually be useful and not just endless mediocre bloat.
<faalentijn>Might be a bit of a funny story (or not) but I did my final project in Python for my community college graduation a month or so back. My teacher almost fainted by the sight of function decorators.
<daviid>faalentijn: fyi, and a bit of history, all this comes from CL, actually CLOS, which 'invented' before and after methods ...
<daviid>faalentijn: way before java and python did even exist ...
<faalentijn>I still have the problem with Guile 2.2.0
<cmaloney>faalentijn: 2.2.0 or 2.2.2?
<amz3>both
<faalentijn>both.
<manumanumanu>so, my racket-style for loops are nearing completion. Still no error reporting, but I am pretty happy with the result right now. The speed is comparable to srfi-42 (unless you use in-hash)
<manumanumanu> https://bitbucket.org/bjoli/guile-for-loops
<manumanumanu>probably pretty portable, since I only rely on guile extensions for silly things.
***ota_ is now known as ota
<faalentijn>I just swiched from (web client) to guile-curl and it works like a charm. Thanks a lot amz3
<manumanumanu>wingo, civodul : peval is king: ,opt (for/sum ([a (in-list '(1 2 3))]) (+ a 1)) => 9
<civodul>of course! ;-)
<cmaloney>I swear, learning Scheme is like a short-cut to learning Computer Science
<cmaloney>ACTION is learning all sorts of new things just in reading wingo's blog posts
<rain1>what did you larn today?
<cmaloney>looking at the concurrency / fibers stuff in recent posts
<cmaloney>and realizing that everything old is new-ish again
<rain1>ah i shoueld read that soon
<cmaloney>I blame paroneayea for this