IRC channel logs

2013-09-07.log

back to list of logs

<dsmith>sneek, later tell wingo wat? https://www.destroyallsoftware.com/talks/wat
<sneek>Got it.
<dsmith>sneek, later tell wingo for continued "js> foo === null" enjoyment
<sneek>Got it.
<mark_weaver>Arne``: One problem with using '+' for string-append is that (+) => 0, and obviously there's no way for '+' to read your mind.
<mark_weaver>Arne``: Maybe consider (define ++ string-append) instead?
<mark_weaver>ArneBab_: ^^
<mark_weaver>Using + for that is likely to lead to bugs, where you do something like (apply + <list>) which works just fine as long as <list> has at least one element, otherwise it breaks.
<mark_weaver>note that this issue doesn't arise with infix languages, because theres no way to use infix '+' with zero arguments.
<mark_weaver>Arne``: fwiw, I would never use any Guile library that adds a method to '+' for string concatenation, because it has global implications for the entire program.
<aidalgol>sneek: help later tell
<aidalgol>bah
<aidalgol>sneek: later ijp Moved bot repo to github. Will explain later.
<aidalgol>sneek: *ahem*
<aidalgol>oh, forgot the "tell"
<aidalgol>sneek: later tell ijp Moved bot repo to github. Will explain later.
<sneek>Will do.
<aidalgol>sneek: thank you
<nalaginrut>morning guilers~
<mark_weaver>hi nalaginrut!
<nalaginrut>mark_weaver: heya~good Saturday
<mark_weaver>nalaginrut: I have a question for you!
<nalaginrut>oh~first time people have question for me ;-D
<mark_weaver>are there any holidays currently happening in China?
<mark_weaver>(right now, that is?)
<nalaginrut>hmm...the most recent I think is middle-moon festival
<nalaginrut>we used to eat moon cake
<mark_weaver>the reason I ask is that I'm trying to buy a Yeeloong from Tekmote, a reseller based in the Netherlands.
<mark_weaver>the web site says they have them in stock, but when I try to add one to my shopping cart, it tells me "Currently unavailable because of the Chinese National Holidays".
<mark_weaver>which makes *no* sense to me, even if it was a holiday currently, which apparently it isn't.
<didi>mark_weaver: Ah, so you find it. I was wondering if it was still possible to buy one.
<nalaginrut>yes mark, National holidays is Oct 1st, there's a month
*mark_weaver wonders if their site has been hacked, to interfere with people in the western world from buying Yeeloongs.
<nalaginrut>but I don't know the effect of the reseller, you know there's some control when National holiday since someone is sensitive for something, dunno ;-P
<nalaginrut>well, is there any sensitive about Yeeloongs?
<mark_weaver>nalaginrut: but if the national holidays don't start until Oct 1st, then why would it be telling me this now? can you think of a legitimate reason why a Netherlands-based reseller would refuse to sell me a Yeeloong that they claim to already have in stock, because of Chinese National Holidays?
<nalaginrut>mark_weaver: yes, that sounds a joke or April fool
<mark_weaver>hehe
<mark_weaver>I'm going to call them on the phone tomorrow.
<nalaginrut>I'll goto my hackspace today, maybe afternoon or evening, there're some guys know something about the electronical manufacture in Shenzhen, maybe they know something
<mark_weaver>nalaginrut: thanks :)
<nalaginrut>I don't know if there's some constrains for the factories before Oct 1st
<nalaginrut>but we used to have long vacation during National holiday
<nalaginrut>maybe this effect the business of the factories
<nalaginrut>mark_weaver: BTW, do we have any plan for register allocator? I think GCC uses the old graph-coloring method, LLVM used linear scan but now they have a new allocator
<mark_weaver>nalaginrut: wingo suggested this thesis to me, but I haven't yet looked at it: http://compilers.cs.ucla.edu/fernando/publications/papers/PhdDiss.pdf
<nalaginrut>seems a new approach
*nalaginrut is reading
*mark_weaver --> zzz
<ijp>morning
<sneek>Welcome back ijp, you have 1 message.
<sneek>ijp, aidalgol says: Moved bot repo to github. Will explain later.
<aidalgol>ijp: evenin'
*ijp grumbles about the correlation between talking on irc and having the client fail
<aidalgol>ijp: You got the memo, though?
<janneke>can i simply use the update manager to upgrade my sg2 from 10.2 and flash gapps later, or are there instructions somewhere?
<janneke>from 10.1 to 10.2 is that
<janneke>ugh, sorry
<janneke>and good morning guilers
<ijp>aidalgol: yes
<aidalgol>You're not going to ask for an explanation?
<ijp>not really
<ijp>I figured I'd mirror it there eventually anyway
<aidalgol>bitbucket is crap for git, basically.
<ijp>hmm, the manual doesn't say what happens if an object doesn't have a particular property
<ijp>we also have string->object, but not object->string
<ijp>also, today is probably the first time I've ever used case-lambda with call-with-values
<ijp>and maybe it would be an idea to wrap the body of define-syntax-rule in an implicit begin
<ijp>aidalgol: ping
<ijp>ijpbot: eval (+ 3 4)
<ijpbot>You need to be my master to do this "ijp"
<aidalgol>ijp: pong
*ijp goes to auth
<ijp>ijpbot: eval (+ 3 4)
<ijpbot>Wrong number of arguments to #<procedure 9ce1440 at cunning-bot/plugins/admin.scm:20:2 (bot sender args)>
<ijp>d'oh
<ijp>ijpbot: help eval
<ijpbot>no help for command: eval
<ijp>typical
*ijp cries into his hands
<aidalgol>I'm off to bed, to dream of lambdas.
<aidalgol>or somethin'
<aidalgol>'night, ijp!
<ijp>oh duh, stupid mistake
<ijp>ijpbot: eval (+ 2 3)
<ijpbot>You need to be my master to do this "ijp"
<ijp>ijpbot: auth
<ijpbot>New authentication string created. Check stdout.
<ijp>ijpbot: eval (+ 2 3)
<ijpbot>Wrong number of arguments to #<procedure 9ce1440 at cunning-bot/plugins/admin.scm:20:2 (bot sender args)>
<ijp>this is not my day
<ijp>ijpbot: quit
<add^_>:-/
<ijp>turns out the problem was that my module exported the wrong 'eval'
<add^_>oh
*add^_ assumes from that comment that ijp wrote his own eval
<ijp>no, but bot commands expect a different interface to built-in eval, so you ned a wrapper
<add^_>oh
<add^_>Right
*add^_ facepalms
<ijp>I can use the built-in eval because currently it's only limited to me, but to make it more generally useful, I'll need to do some simple sandboxing
<ijp>but not the fancy pants kind rudybot can do :(
<add^_>Why not?
<ijp>because that does require writing a whole new eval
<add^_>:-/
<ijp>racket's sandbox had resource limiting, and cool stuff like that
<add^_>ah
<add^_>right
<ft>Hm, I'm modifying a list (namely, I am inserting a new item at a given index), which seemed to work fine. But then I byte-compiled the code and it suddenly stopped working. Here is a fairly minimal test case: http://paste.debian.net/36431/
<ft>This doesn't happen if I introduce foo as a global binding using `define' instead of a local one using `let'.
<ft>Is this a bug or am I doing something stupid? :)
<ijp>ft: quoted lists are immutable
<ijp>if you change it to (list ...) it should work
<ft>ijp: indeed it does. ...but when I do (format #t "~a~%" foo) after `list-insert!', it prints (aa bb cc FOO dd ee ff) in compiled and non-compiled execution.
<ft>And why does (define foo '(aa bb ...)) not show the same behaviour?
<ijp>that is a good question
<ft>I'd also expect the interpreted and the byte-compiled execution to both have the list immutable. ...but maybe that's unspecified behaviour. I don't know.
<ijp>wingo: you want to field this one :)
<wingo>ohai :)
<sneek>Welcome back wingo, you have 2 messages.
<sneek>wingo, dsmith says: wat? https://www.destroyallsoftware.com/talks/wat
<sneek>wingo, dsmith says: for continued "js> foo === null" enjoyment
<wingo>oh yes, i know that presentation :)
<ijp>also guile non-existent.scm gives a truly horrible error message on master
<wingo>that's exciting
<wingo>so what's the question?
<ijp> http://paste.debian.net/36431/
<ijp>ft wants to know why if he changes that let to a define, it allows him to mutate the list
<wingo>how would you change that let into a define?
<ft>wingo: yes, what ijp said. Also, why does a print (format #t "~a~%" foo) after the `list-insert!' show a mutated list in interpreted and byte-compiled execution?
<ft>sec.
<ijp>wingo: (let ((foo list)) body ...) => (define foo list) body ...
<wingo>in 2.2 we should be able to raise errors when attempting to mutate immutable data
<wingo>using segv handlers and page protection
<ft>wingo: http://paste.debian.net/36454/
<ijp>the lack of an error is troubling, but it's not what I find weird
<ijp>ft: also, your procedure doesn't handle the null list case (obviously)
<ijp>but it raises an issue you'll find with other list! methods
<ijp>which is that list! methods don't always mutate the list, so you should always use their return value
<ft>ijp: Yeah, it's a utility function for other code that doesn't call is with an empty list.
<ijp>well, if it won't be exported, then it's fine
<ijp>but the ! issue is a FAQ
<ijp>at least the docs correctly reflect it now
<wingo>hummm, it seems that the let case is actually a bug in the optimizer (!)
<ft>ijp: can you point me to the section in the documentation that discusses this?
<wingo>or is it?
<wingo>anyway check it:
<wingo>scheme@(guile-user)> ,optimize (let ((foo '(aa bb cc dd ee ff))) (list-insert! foo 3 'FOO) (if (equal? foo '(aa bb cc FOO dd ee ff)) (format #t "Yay!~%") (format #t "Nay!~%")))
<wingo>$2 = (begin
<wingo> (list-insert! '(aa bb cc dd ee ff) 3 'FOO)
<wingo> (format #t "Nay!~%"))
<wingo>an interesting transformation
<wingo>i think it's valid too
<ijp>ft: the srfi 1 docs cover it, but the normal docs for append! and reverse! are only fixed in stable git (so you'd need to look that up on the online docs)
<wingo>because foo is unassigned and a constant literal
<wingo>ft: probably if you throw the format in there, the optimizer decides not to propagate the constant, so you get the other behavior
<wingo>so the real fix is to make set-car!/set-cdr! of an immutable pair raise an error
<wingo>something we should have for 2.2 but can't do in 2.0
<ft>ah, okay.
<ft>Thanks guys.
<wingo>np
<wingo>apologies for the strange behavior here :)
<civodul>Hello Guilers!
<add^_>hey civodul
<wingo>heya civodul :)
<ijp>d'oh
<mark_weaver>ijp: ?
<ijp>it's funny when you start typing your problem into IRC, and then suddenly figure out exactly what was wrong
<mark_weaver>I find that sometimes formulating a question clarifies the issue :)
<ijp>now I have to go fix a macro
<dsmith>mark_weaver, Yes!
<ijp>hmm, actually, I don't need to touch the macro at all, bonus
<ijp>what's the correct way to set docstrings programmatically?
<ijp>I had thought object-documentation was an object-property and so I could (set! (object-documentation foo) "bar")
<ijp>hmm, and what's thd difference between object-documentation and procedure-documentation
<mark_weaver>ijp: object-documentation, defined in (ice-9 documentation) works in more cases than procedure-documentation.
<ijp>I'm looking now
<mark_weaver>if it's a macro, it looks for the docs on the transformer.. if it's defined in C, then it looks in 'guile-procedures.txt'.
<ijp>well, since they are distinct, and object-documentation uses procedure-documentation, that explains why it isn't a regular object property
<mark_weaver>TBH, I don't really like the way things work currently.
<mark_weaver>For C procedures at least, it seems better to arrange for the docstring to be a procedure property of the generated VM stub. but maybe that's a bad idea for some reason I don't see.
<ijp>it would be an idea to get rid of procedure-properties as things distinct from object-properties
<ijp>at the same time, maybe deprecate the old style properties officially
*ijp makes a note to discuss this on the mailing list
<ijp>anyway, to answer my question, it seems the "correct" thing to do is to use (set-procedure-property! proc 'documentation docstring)
<ijp>or (object-property object 'documentation docstring)
<mark_weaver>yeah, maybe object-properties is the way to go. I'd be curious to hear what other people think too.
<ijp>well, procedures are objects, so there is no loss of generality
<mark_weaver>indeed. it would certainly be nice to have just one mechanism.
<mark_weaver>on the other hand, there is an expense to weak hash tables.
<mark_weaver>weak references are relatively expensive for the GC to deal with.
<ijp>you could treat it specially under the hood
<ijp>I just want one interface
<mark_weaver>yeah, it should definitely be just one interface.
<mark_weaver>also, I notice that a lot of things don't have doc strings.
<mark_weaver>the semantics of weak hash tables is also kind of messy. for example:
<mark_weaver>(define foo (make-object-property))
<mark_weaver>(set! (foo 'blahblah) 1)
<mark_weaver>(foo 'blahblah) => 1
<mark_weaver>(gc) (foo 'blahblah) => #f
<mark_weaver>ick
<ijp>yeah, both me and wingo have bug reports in the tracker about weak hash tables
<ijp> https://github.com/aidalgol/cunning-bot/commits/plugins coming along nicely
<ijp>there is a problem with "modules as plugins" looming on the horizon when running multiple bots, but I'll cross that bridge when i get to it
<foeniks>hi I am getting an error "Wrong type to apply: proc-name" (where proc-name is some function in my code)
<foeniks>(define (proc-name port) ....)
<foeniks>from the backtrace it seems that proc-name is never netered by the interpreter
<foeniks>so it must be an issue while calling it
<ijp>do you have some code I can run and see for myself?
<ijp>what you've said isn't really enough to debug it
<foeniks>yeah, let me see
<taylanub>Could it be that you tried to apply the symbol 'proc-name instead of the procedure ?
<ijp>that's a reasonable hypothesis
<foeniks>hmm
<foeniks>actually, yes
<foeniks>now that you say it
<foeniks>I stored some procedures in a list (define *lst* '((#\\a fn1) (#\\b fn2)))
<foeniks>so probably they are quoted symbols
<didi>Does Guile have a limit on the number of arguments a procedure can apply?
<ijp>didi: no
<didi>Uh.
<ijp>except, I suppose, by the limit of the stack
<didi>Fair enough.
<ijp>scheme@(guile-user)> (apply + (iota 10000)) $1 = 49995000
<ijp>scheme@(guile-user)> (apply + (iota 100000)) --- stack overflow
<ijp>10000 arguments ought to be enough for anyone, though
<didi>Using `apply' with lists can be tricky.
<ijp>foeniks: I'd recommend using quasiquotation, but you could reflect on the module to lookup up a function name by its symbol
<foeniks>ijp, I have changed it to quasiquotation already, thanks ;)
<ijp>aidalgol: moar commits
<aidalgol>ijp: got 'em
<ijp>ech, I left a pk in one
*ijp loads his global interpreter lock and stalls ijp.
<aidalgol>pk?
<ijp>pk is like id, but it prints out the value
<wingo>i would like to effectively raise that limit (stack limit)
<wingo>not sure how though
<wingo>either overflow/underflow handlers or just mmap a big ol' region of memory, maybe both
<ijp>someone (i.e. not me) should write a git commit hook that rejects commits with pk's still in the code
<wingo>there was an interesting thread about this on the rust dev ml recently
<ijp>aidalgol: e.g. (pk 'foo 'bar 'baz)
<ijp>;;; (foo bar baz)
<ijp>$2 = baz
<wingo> https://mail.mozilla.org/pipermail/rust-dev/2013-July/004686.html
*ijp files away
<wingo> http://forum.dlang.org/post/jtcn0a$2sft$1@digitalmars.com also
<dsmith>Walter Bright!
<aidalgol>ijp: wat?
<dsmith>That's a name I haven't heard in a while.
<dsmith>Who remember Zortech C++ ?
<wingo>maybe we can do segmented stacks, as we can relocate stack segments...
<wingo>humm
<aidalgol>Is a wingo like a wino?
*aidalgol runs.
<dje42>Is it possible to give a scheme function defined in C a doc string?
<ijp>yes
<ijp>actually, if you look back about 3 hours, I was just discussing a similar situation
<wingo>i mailed guile-user about that recently
<ijp>and there is a field in SCM_DEFINE for docstrings
<wingo>so regarding stacks, i think the thing to do is to mmap a big ol memory region
<ijp>s/field/argument/
<wingo>and on every update to vp->sp (which doesn't happen that often) you record the max stack height
<wingo>and on gc if the max stack height is more than a page away from the current sp you MADV_DONTNEED
<wingo>and make the mark function only mark up to the vp->sp of course
<wingo>mark_weaver: ^
<wingo>just because i thought you would be interested ;)
<wingo>so we reserve a lot of vaddr space but we make sure to return pages to the os
<wingo>and of course pages that are never touched are never part of the rss
<wingo>that would let us implement map in the sensible way
<wingo>recursively.
<aidalgol>How easy is guile to embed (in a C or C++ program) compared to racket?
<wingo>aidalgol: probably easier, as it has a nicer and more stable C API/ABI
<wingo>but they are not dissimilar
<wingo>guile is probably easier, i mean
<aidalgol>Guile was also designed to be easily embeddable from the get go, wasn't it?
<wingo>yes, but racket was similar
<wingo>it is less similar now i think
<wingo>or maybe returning pages to the kernel is not important
<wingo>i want to be able to write algorithms that assume that the stack is as big as the heap
<wingo>on any 64-bit machine that is the case
<didi>wingo: That would be lovely.
<wingo>catching stack overflow would be tricky though!
<wingo>assuming you wanted to, anyway
<dje42>Ah. scm_set_procedure_property_x (to set the documentation property)
<foeniks>is there something like Marginalia or docco for scheme code? http://fogus.github.io/marginalia/
<didi>foeniks: What are they?
<foeniks>basically they put comments and code next to each other
<foeniks>side by side
<foeniks>It really helps when reading code since the comments don't clutter the code you are reading
<didi>foeniks: So they are like post-processors?
<didi>I mean, you run it against your source file and it outputs a HTML.
<didi>Is it a fair characterization?
<foeniks>I would say so
<foeniks>the link shows pretty much the output of marginalia with clojure code
<didi>I'm not familiar with such thing, I'm afraid.
<didi>Maybe others are.
<foeniks>since I did not find something like marginalia with google, I just thought someone might know something like this