IRC channel logs

2016-09-28.log

back to list of logs

<sapientech1>paroneay`: hey hey looking at pubstrate, and i noticed it uses goops. what was your reasoning for defining some classes?
<DeeEff[m]>stis: immediate con (from someone who's too busy to read into it too hard / doesn't know prolog): I hate that it looks like `less-than-or-equals` sign but technically implies an infix arrow
***n8a_ is now known as n8a
<paroneayea>sapientech1: only some utility parts of pubstrate use goops, specifically the web widgets system and the storage system
<paroneayea>and the reason for that is: generic methods are great :)
<paroneayea>I wanted something in both those cases where I could switch out behavior for different types extensibly, and that's a feature which GOOPS provides.
<webshinra>hum
<sapientech1>paroneayea: hey thanks for getting back. it's pretty cool how goops does generic functions :) will continue to look at the storage system!
<sapientech1>also, im interested in developing a few webapps with guile, so im down to help you make the standalone webapp modules from pubstrate you were mentioning
<jmd>A bargain for those who like vanity addresses: http://www.homesnap.com/CT/Guilford/27-Guile-Road
<paroneayea>sapientech1: cool, yeah I'll be looking at splitting it out shortly
<webshinra>Is their a way to run guile "naked" ie: without guile-specific procedure being in the namespace?
<webshinra>(like sort-list λ etc.)
<paroneayea>hello #guile!
<OrangeShark>hello!
<paroneayea>ACTION at a coworking space in London
<jmd>I'm considering writing guile bindings for parted. Can anyone think of a reason why that is not a good idea?
<paroneayea>jmd: no
<paroneayea>sounds like a good idea...
<paroneayea>jmd: does it expose a C api you can talk to?
<jmd>paroneayea: It depends on what you mean by "API" and "expose" !!!
<jmd>I doubt they will guarantee that it doesn't change.
<paroneayea>jmd: well, if something is exposed, you can use the FFI
<paroneayea>I can't say anything about guarantees
<jmd>What do you mean by "expose" in this context?
<paroneayea>jmd: whether or not it exposes procedures / datastructures to access via its headers... read the FFI docs in Guile's manual for more info and examples.
<jmd>Yeah that I don't know, currently.
<paroneayea>jmd: well, read the docs. It'll help you know!
<amz3`>anyone read the code of guile tjit aka. nash ?
***holomorp1 is now known as holomorph
<amz3``>so what...
<amz3``>I'm not sure where to go with culturia right now
<stis>DeeEff[m]: Hmm mayb <- is better. But <= is free in prolog there the less eqiual etc is =< and >=
<stis>I think it is choosen like that to use implication => and <= as a meaning of thouse.
<DeeEff[m]>stis: yeah. In Prolog it may make sense, but if it's an arrow then maybe `<-` would disambiguate? In general `=>` and `<=` are just overloaded anyways. In a perfect world we'd have unicode symbols for actual arrows that we could easily type and use.
<amz3``>← is alt gr pad num 4
<amz3``>on my keyboard at least
***amz3`` is now known as amz3
<stis>amz3: cool! I'm unicode using set operators already maybe force peolpe into emacs syndrome :)
<stis>Okej, if one uses latex input method then it is \\leftarrow = ←
<stis> http://c-lambda.se/return-values.html to see the typographical result
<stis>There is also the option to use rightarrow e.g. goal -> [X].
<stis>yep blog updated
<stis>what I don't like woith right arrow is that in named returns, the value is bound before the goal.
<stis>But in a right arrow form the name of the retrun comes after the goal
<lluis>I have a simple C program that loads a user script (scm_c_primitive_load) and calls a function (foo) that raises an error (calls a non-existing bar). I've captured the call stack (scm_make_stack) in the pre_unwind handler of scm_c_catch, but display-backtrace does not show the name of the failing function (foo).
<lluis>any ideas what might be wrong?
<stis>what is the module the c code lookups in, try execute (module-name (current-module)) from C
<stis>then you can grovel for the available bindings to see if it's there
<stis>like (module-ref (current-module= 'foo)
<stis>like (module-ref (current-module) 'foo)
<stis>ooh foo is missing in the backtrace, err, maybe a bug donough
<stis>try make (define (foo2) (foo)) and see if foo shows up
<stis>in the backtrace
<lluis>ok, so now the error is in the sequence foo -> bar -> baz -> nonexisting, but the stack trace does not show them:
<lluis> https://paste.gnome.org/pqafttc9h
<lluis>the "key" and "parameters" from the handler are: "unbound-variable" and "(#f Unbound variable: ~S (nonexisting) #f)"
<stis>ahh tail calls
<lluis>aha! you mean that's because of the optimizer?
<stis>(define (foo2) (let ((r (foo)) (pk 'foo2)))
<stis>then you should get the backtrace for foo2
<lluis>sorry, what's that supposed to do?
<stis>the pk will force the foo2 to keep it's frame on the stack
<stis>else foo will reuse foo2 stack
<lluis>mmm, can't this be done without changing the user's script? (the one that fails)
<stis>Three are methods that keep a trace of the function stacks but it is not implemented for guile
<stis>you could redifine teh define binding to issue a op at the end that does not change the semantic
<stis>and make sure that the user script uses that define in stead of the normal define
<stis>bonus points to make sure that the generated procedure get's the right naming
<lluis>the backtrace is still rather unhelpful...
<lluis>this is the user script: https://paste.gnome.org/p7fh0obd4
<lluis>and the backtrace: https://paste.gnome.org/pr6nxhyrf
<stis>yes that is mostly tail calls
<lluis>even if I add displays to ensure they're not tail calls, the backtrace does not contain the user's file name nor the procedure name
<lluis>I mean adding a silly display after the call to another function
<lluis>like this: https://paste.gnome.org/peiiyk3cx
<stis>(define-syntax-rule (define (name . args) code ...) (define name (let () (define (name . args) (let ((ret (begin code ... ))) (set! n (+ n 1)) ret))))
<stis>yes, but also see my little modified define, just make sure (define n 0) is issued
<stis>you can keep that in a module and import it when needed to debug
<stis>meke sure to export with #:replace for that module though
<lluis>sorry, that gives me a syntax error (pasted it before the user's defines), and my scheme is rather clunky on these things
<lluis>guile: uncaught throw to syntax-error: (#f source expression failed to match any pattern ((line . 13) (column . 0) (filename . /home/lluis/Projects/qdbi-guile/example.scm)) (define baz (let () (define (baz) (let ((ret (begin (display baz
<lluis>) (nonexisting) (display baz-end
<lluis>)))) (set! n (+ n 1)) ret)))) #f)
<stis>okey I though you could fix it. Let me make a module for you hang on a minute
<lluis>thx a lot
<stis>lluis: https://paste.gnome.org/peiiyk3cx
<stis>I added comments for you, tyhe last one is tested and works on my box
<stis>the last one in time, the newest is on top it looks
<lluis>thx
<lluis>I just pasted it on top of the user file (I haven't set up search paths from C)
<lluis>so it should work the same
<lluis>the thing is, the backtrace still contains no file, line, procedure information
<lluis>is this due to me using scm_c_primitive_load to load the user's script?
<lluis>it's basically: scm_c_primitive_load("example.scm"), scm_call_0(scm_variable_ref(scm_c_lookup("foo")))
<lluis>but you can see that frames 3 and 2 do not show the user script locations: https://paste.gnome.org/pmilaote5
<lluis>(that backtrace is without your define code, with it it's just more frames with empty info)
<stis>if you place the code in a module I think that and load the module you can get better backtrace
<stis>did you place the code in a file and load it?
<lluis>yes, it's in "example.scm" (has a "define-module (example))" at the top), and I loaded it from C using scm_c_primitive_load("example.scm")
<stis>try eval (load "example.scm") from C
<stis>I think that scheme load is more featureful
<stis>Im not good at this C interfacease though, I'm mostly extending in stead of embedding
<lluis>ok, I'll try that tomorrow, thx a lot
<stis>sleep well
<lluis>btw, I could not resist it and tried the eval load, it works like a charm, thanks :)
<stis>:)
<daviid>hello guilers!
<stis>heya daviid!
<daviid>hello stis
***logicmoo is now known as dmiles