IRC channel logs
2013-09-07.log
back to list of logs
<dsmith>sneek, later tell wingo for continued "js> foo === null" enjoyment <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>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: later ijp Moved bot repo to github. Will explain later. <aidalgol>sneek: later tell ijp Moved bot repo to github. Will explain later. <mark_weaver>are there any holidays currently happening in China? <nalaginrut>hmm...the most recent I think is middle-moon festival <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 <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 <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 <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>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 <sneek>Welcome back ijp, you have 1 message. <sneek>ijp, aidalgol says: Moved bot repo to github. Will explain later. *ijp grumbles about the correlation between talking on irc and having the client fail <janneke>can i simply use the update manager to upgrade my sg2 from 10.2 and flash gapps later, or are there instructions somewhere? <aidalgol>You're not going to ask for an explanation? <ijp>I figured I'd mirror it there eventually anyway <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>ijpbot: eval (+ 3 4) <ijpbot>You need to be my master to do this "ijp" <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 cries into his hands <ijp>oh duh, stupid mistake <ijp>ijpbot: eval (+ 2 3) <ijpbot>You need to be my master to do this "ijp" <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>turns out the problem was that my module exported the wrong 'eval' *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 <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 :( <ijp>because that does require writing a whole new eval <ijp>racket's sandbox had resource limiting, and cool stuff like that <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 :) <sneek>Welcome back wingo, you have 2 messages. <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 <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? <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 <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>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> (list-insert! '(aa bb cc dd ee ff) 3 'FOO) <wingo>an interesting transformation <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 <wingo>apologies for the strange behavior here :) <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 <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. <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>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: <ijp>yeah, both me and wingo have bug reports in the tracker about weak hash tables <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>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 <taylanub>Could it be that you tried to apply the symbol 'proc-name instead of the procedure ? <ijp>that's a reasonable hypothesis <foeniks>I stored some procedures in a list (define *lst* '((#\\a fn1) (#\\b fn2))) <didi>Does Guile have a limit on the number of arguments a procedure can apply? <ijp>except, I suppose, by the limit of the stack <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 <ijp>ech, I left a pk in one *ijp loads his global interpreter lock and stalls ijp. <ijp>pk is like id, but it prints out the value <wingo>i would like to effectively raise that limit (stack limit) <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) <dsmith>That's a name I haven't heard in a while. <wingo>maybe we can do segmented stacks, as we can relocate stack segments... <dje42>Is it possible to give a scheme function defined in C a doc string? <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 <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>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 <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>guile is probably easier, i mean <aidalgol>Guile was also designed to be easily embeddable from the get go, wasn't it? <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>basically they put comments and code next to each other <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>the link shows pretty much the output of marginalia with clojure code <didi>I'm not familiar with such thing, I'm afraid. <foeniks>since I did not find something like marginalia with google, I just thought someone might know something like this