IRC channel logs

2015-02-20.log

back to list of logs

<nalaginrut>wingo: once you've told me that continuations are actually basic blocks. Does it mean we can handle CPS without generating basic blocks, or we treat continuations as basic blocks in CPS?
<wingo>nalaginrut: hmm :) have you read the "lambda, the ultimate goto" paper?
<wingo>there is a point in that paper where he shows how some continuations are just labels, and he actually emits labels for them when compiling
<wingo>that's what we do
<nalaginrut>wingo: well, thanks for hint, I collected this paper but never read ;-P
<wingo>but that also means that in Guile's intermediate representation the continuations that we represent are only a subset of all continuations inthe program --
<wingo>specifically guile's continuations are only those continuations that can be compiled to labels
<nalaginrut>wingo: nice to know that ;-)
<wingo>now basic blocks are made up of labelled expressions
<wingo>but not every label is a basic block
<nalaginrut>I guess it's convenient for AOT, right?
<wingo>because if a label is always in a line with other labels -- only one predecessor and only one successor -- then it is a part of some larger basic block
<wingo>so it's more accurate to say that guile's continuations are labels
<wingo>i mean, the continuations in the CPS IR
<nalaginrut>and I guess this subset of continuation may not provide a general IR for any languages, which implies the font-end on Guile maybe constrained, is that true?
<nalaginrut>wingo: thanks for explain it!
<wingo>hmm
<wingo>so we have another thing in the IR, which are function calls
<wingo>in a true CPS IR every function call receives a continuation as an argument
<wingo>but in Guile's CPS we assume there is a stack, and that functions return to their callers
<wingo>there's nothing more or less general, i don't think
<wingo>just different ways of solving the same problem
<nalaginrut>oh, does it mean we could make the IR generic anyway, but some font-end language may lose some features of AOT
<wingo>dunno
<wingo>not sure how it relates
<nalaginrut>well, these questions maybe ask too early...
<wingo>i think guile's cps is fine for aot as it is -- the other thing you want there are types
<wingo>so we might lower to a typed cps, dunno
<nalaginrut>wingo: thanks for telling me so much ;-D
<wingo>np :)
*nalaginrut keep reading ...
*davexunit envies racket's built-in support for image manipulation.
<davexunit>would be so cool to have images at the REPL.
<wingo>:)
<davexunit>and since I have likely just volunteered myself to do it, I say: some day.
<wingo>yeah for reals
<wingo>a web repl would be nice
<wingo>like, a nice web repl.
<wingo>like ipython's notebooks, sort of thing.
<davexunit>a web repl has also been on my mind.
<davexunit>I'm not sure of the implementation details, though.
<davexunit>the regular REPL runs in a loop
<davexunit>but for the web repl, you'd need a web server running as well, feeding things in.
<wingo>yeah good question -- do you let the repl drive, possibly with delimited continuations, or do you build it just as a web app
<wingo>i think i would probably do the latter, so you could use whatever js you wanted to on the client side, but dunno
<wingo>seems like the right thing is not much code but there are many wrong things :)
<davexunit>using delimited continuations was how the cooperative REPL server was made, but that's a different thing.
<davexunit>would you worry about handling multiple users?
<davexunit>should each user session get a new guile process?
<davexunit>ya know, so I can't rebind + to (lambda args (display "fart
<davexunit>))
<davexunit>and mess up everyone else's day.
<dsmith-work>Happy Friday, Guilers!!
<nalaginrut>davexunit: well, if let me choose, I would go wingo 's way for a webapp. I can even imagine the whole architecture of it, but I have no plan to do that ;-P
<wingo>would binding + to fart be so bad? :)
<ArneBab>davexunit: could the web repl be done by compiling against asm.js?
<wingo>for me i would think that one server would be for one person.
<wingo>one person could have multiple repls open but since you can do just about anything with guile it's not well-suited to multiple users right now
<wingo>unless you have a good sandboxing story, and that's hard as we can't dynamically limit memory use for delimited continuations...
<davexunit>wingo: yeah, fair enough. that simplifies things greatly.
<nalaginrut>yeah, and contact each independent server with cookies
*nalaginrut means session id
<Profpatsch>Is there a way to disable the welcome message when running a script?
<Profpatsch>It’s kind of irritating.
<Profpatsch>Oh, wait, I’m piping in stuff.
<Profpatsch>So, is there a way to disable it in general? Command line switch?
<dje>gdb -q
<dje>Or if not running interactively gdb --batch, or --batch-silent
<davexunit>dje: do you mean 'guile'?
<dje>Oh geez, back from holidays and a little sleepy ... wrong channel. :-)
<davexunit>-q in guile will just "inhibit loading of user init file"
<davexunit>:)
<Profpatsch>davexunit: But does --batch-silent exist?
<daviid>wingo: did you locally change your guile-lib congifure.ac to add serial-tests as well [maybe]?
<wingo>daviid: no, i think i just haven't built guile-lib in forever
<wingo>dje: :)
<dje>Interesting question though. Does guile have the equivalent of gdb's -q?
<wingo>dje: i don't think so, perhaps it should
<daviid>wingo: i just did :) [I, on purpose, did choose to setup a /opt2 for my tests using guile-2.1, guile-gnome needs it ...], so i guess it needs that option right?
<paroneayea>wingo: your gdb email was interesting
<wingo>daviid: probably yes
<wingo>paroneayea: yak-lover :)
<paroneayea>wingo: guilty as acharged
<wingo>:)
<paroneayea>*charged
<daviid>guile-gnome [using guile-2.1] make check reports unbound(s) wrt sxml [pretty-print], texinfo [seed] and then fails compiling glib/gnome/gw/support/gtk-doc.scm with Unbound variable: define-parsed-entity!
<daviid> http://paste.lisp.org/+34J5
<daviid>and these texinfo as well:
<daviid>texinfo/reflection.scm:128:17: warning: possibly unbound variable `local-eval'
<daviid>texinfo/reflection.scm:131:18: warning: possibly unbound variable `procedure-environment'
<daviid>wingo: i don't have guile-lib write access, so i made this configure.ac change locally
<davexunit>so, I was watching this video by William Byrd https://www.youtube.com/watch?v=8KSw-u2o8ew
<davexunit>it's about macros
<davexunit>and I just got to a point where they were implementing 'or'.
<davexunit>and they talked about having to use let to avoid evaluating part of the form twice.
<davexunit>in particular, this case:
<davexunit>((or e e* ...) (if e e (or e* ...)))
<davexunit>they used (or (display "hi")) to show that "hi" would be displayed twice. this was in Chez Scheme.
<davexunit>evaluated once in the test form of 'if', and then again in the consequent form.
<davexunit>however, in Guile, I don't see this behavior.
<davexunit>"hi" is displayed only once.
<mark_weaver>davexunit: what exactly did you type?
<mark_weaver>I tried this: (define-syntax or (syntax-rules () ((or e e* ...) (if e e (or e* ...))) ((or) #f)))
<mark_weaver>and then (or (display "hi")) displays "hihi"
<davexunit>oh I see what I did :)
<davexunit>I'm dumb! nevermind me.
<davexunit>I had an additional case that handled a single argument
<davexunit>((or e) e)
<davexunit>so of course it was only evaluated once!
<mark_weaver>heh :)
<mark_weaver>and indeed, that single-argument case is important to implement proper semantics for Scheme 'or'.
<davexunit>hmm, actually.
<davexunit>(define-syntax or
<davexunit> (syntax-rules ()
<davexunit> ((_) #f)
<davexunit> ((_ e) e)
<davexunit> ((_ e e* ...)
<davexunit> (if e e (or e* ...)))))
<davexunit>then run:
<davexunit>(or #f (display "hi\\n"))
<davexunit>I only get a single "hi"...
<mark_weaver>by those rules, (or #f (display "hi\\n")) expands to (if #f #f (or (display "hi\\n"))) and then the single-argument case is used to expand the remaining 'or'.
*mark_weaver goes afk
<davexunit>mark_weaver: thanks. knew I was missing something else.
<davexunit>(or #f (display "hi\\n") #f)
<davexunit>clearly demonstrates the problem
*davexunit has finally begun to understand syntax-case
<mark_weaver>cool!
<davexunit>it still surprises me a lot, but I was able to write a simple macro that used with-syntax
<davexunit>this macro is useless, but is there a more concise way to write it? http://paste.lisp.org/display/145844
<davexunit>I tried writing it without 'with-syntax' and failed.
<mark_weaver>davexunit: it can be done with quasisyntax, a.k.a. #`
<mark_weaver>however, the argument to syntax->datum should be #'name, not #'(name), I think. I'm not sure how that's even working.
<davexunit>mark_weaver: that's a paste mistake, sorry.
<mark_weaver>but you should be able to write something like #`(define #,(symbol-append ...) value)
<davexunit>I undid a macro I wrote...
<davexunit>should've eval'd
<mark_weaver>with-syntax probably results in more readable code here though.
<davexunit>I wrote a macro called 'datum' to replace (syntax->datum (syntax <pattern-variable>))
<mark_weaver>sorry, I meant to write #`(define #,(datum->syntax ...))
<davexunit>ah yes, quasisyntax makes perfect sense.
<davexunit>I agree that with-syntax is more readable
<davexunit>but I knew it had to be possible to accomplish the same goal without it.
<mark_weaver>with-syntax is kind of like 'let' for pattern variables
<mark_weaver>it's actually just a macro that expands into a use of syntax-case
<davexunit>cool
<mark_weaver>sort of like 'let' can be implemented as a macro that expands into a use of 'lambda'.
<davexunit>yeah, makes sense.
<davexunit>thanks mark_weaver
<mark_weaver>anytime!
<davexunit>I got the very basics of syntax-rules down awhile ago, but syntax-case was always scary.
<mark_weaver>heh :)
<davexunit>I now have a chance of grokking civodul's define-record-type* macro
<mark_weaver>macros are fairly easy to get started with, but it's quite the rabbit hole to go down, to understand how the machinery works.
<mark_weaver>I remember thinking about 10 years ago that I was ready to write my own scheme implementation from scratch, and I was almost right, but when I sat down to do it, I realized that I didn't yet understand the macro system well enough.
<davexunit>yeah, I have a long way to go to understanding how this stuff is actually implemented.
<davexunit>need to learn more about compilers in general.
*paroneayea too
<paroneayea>so much to learn
<stis>cheers guilers!
<paroneayea>stis: heya, how's guile-log going?
<paroneayea>I've been meaning to try it eventually...
<stis>it' s pretty cool, in a hefty development, just check the commits.
<stis>I'm working on getting some serious prolog code working on it.
<stis>and get pretty good support for swi prolog constructs
<stis>just recently I added a boolean sat solver, clpb.pl
<paroneayea>stis: neat
<stis>right now I'm working on using indexing per default and get rid of nasty gc issues
<stis>that and the ability to use prolog macros.
<paroneayea>stis: btw https://gitorious.org/gule-log/guile-log/source/efb8a797012cbc276b253477b63d17ade3a541ed:LICENSE.TXT LGPL v2... not v2 or later?
<stis>yep LGPL v2 or 3 it's your choice
<stis>I have taken some source code from the swi prolog release, I need to make that copyright clear though
<paroneayea>stis: right, though it only says v2
<stis>it shuld be v2 or later
<stis>I can fix it if there is an issue
<paroneayea>stis: anyway, neat stuff... and I just noticed so thought I'd ask :)
<stis>paroneayea: yes it is pretty unique with pretty cool features, 10x slower then swi prolog but sports delimited continuation, tablating rational datatsructures and of cause great interoperarion with kanren
<stis>it's just it is bloody hard to get all the details right and good feature parity with stand alone prolog implementations
<davexunit>I wonder if we should get a guile-websockets library before writing a guile web REPL
<davexunit> http://wiki.call-cc.org/eggref/4/websockets#quick-start-example
<davexunit>websockets for chicken scheme :)