IRC channel logs

2013-09-05.log

back to list of logs

<davexunit>I have 2 modules that import each other. I have a feeling that this is bad.
<ijp>yes
<didi>Did you know Go forbids circular dependence?
<ijp>a lot of languages do
<davexunit>I need to figure out how to better modularize this...
<ijp>in some situations in guile, you might get away with it
<davexunit>I separated my game data structures from the code that runs the game loop.
<davexunit>and now have a circular dependency.
<ijp>did you try it and check that it actually failed?
<davexunit>it doesn't fail, but what I don't like is that I get "possibly undefined variable ..." warnings
<davexunit>so I'm going to restructure things.
<ijp>well, you could separate out just the raw-type + accessors, into a third module, and import that into a fancy-type, and your game loop
<davexunit>yeah.
<davexunit>I'll do that.
<ijp>I like to use (project private ....) for the names of modules like that
<mark_weaver>davexunit: you around?
<davexunit>mark_weaver: hey
<mark_weaver>so about mvars.scm: it uses a case-lambda docstring syntax that wasn't added until 2.0.9. that's easily fixed by removing the docstring, but the better solution would be to switch to the new version of mvars.scm I posted. the one you're using is buggy (although I think you probably won't run into the bug the way it's being used in guile-2d)
<davexunit>okay, I'll switch.
<mark_weaver>however, the API changed a bit. I think the only change you'll notice is that you should use (new-empty-mvar)
<davexunit>alright.
<mark_weaver>the new version should also work on older versions of guile too.
<davexunit>okay cool.
<davexunit>I will update it.
<mark_weaver>:)
<davexunit>I'm currently translating all of my examples to use a new declarative way of describing games.
<davexunit>less code, less procedural. :)
<nalaginrut>morning guilers~
<davexunit> https://raw.github.com/davexunit/guile-2d/wip-scenes/examples/simple.scm
<mark_weaver>looks nice and simple :)
<ijp>mark_weaver: I haven't looked at the updated version in much detail, but why were those atomicity guarantees removed?
<ijp>just for consistency with haskell?
<mark_weaver>well, I decided that if they didn't have them, there was probably a good reason for it.
<ijp>fair enugho
<ijp>enough
<mark_weaver>I suspect it might have to do with issues that arise when implementing it efficiently, or doing compiler optimizations on it.. fewer primitives seems preferable, if the atomicity guarantees aren't important.
<mark_weaver>we can always add those guarantees later, but we can never remove them once we've made the promise.
<mark_weaver>the reason I say "fewer primitives" is because the non-atomic 'read-mvar' and 'swap-mvar', as found in Haskell, are implemented in terms of 'put-mvar' and 'take-mvar'.. whereas my atomic versions had to be primitives in their own right.
<nalaginrut>seems cool~
<mark_weaver>hi nalaginrut :)
<nalaginrut>mark_weaver: heya~
<nalaginrut>most of TODO in Artanis was done, especially the template bugs, it's gone when new template engine was born
<nalaginrut>and cookie bugs was fixed
<nalaginrut>seems the rest is relational mapping
<nalaginrut>and a proper auth module
<mark_weaver>that's good news!
<mark_weaver>I have to go afk for a while, ttyl...
<nalaginrut>see you
<davexunit>I need to give artanis a try. I do web development for a living and it sounds nice to use scheme for that purpose.
<davexunit>night mark_weaver
<davexunit>thanks for the help
<mark_weaver>you're welcome. good night!
<nalaginrut>davexunit: Artanis will have MVC and cli code-generator tools later
<davexunit>awesome!
<davexunit>keep up the great work.
<nalaginrut>davexunit: I'll try gnumaku for a game
<nalaginrut>and learn something to implement actor-model
<nalaginrut>I haven't had a time for actor-model design with delimited-continuation
<davexunit>nalaginrut: you'll want to check out guile-2d, not gnumaku
<davexunit>I need to research the actor model.
<nalaginrut>alright
<nalaginrut>me too ;-)
<davexunit> https://github.com/davexunit/guile-2d
<davexunit>good night
<didi>How does Guile implement simultaneous definitions inside a `define'?
<ijp>didi: it gets translated into letrec*, which is like letrec with guaranteed left-to-right evaluation
<ijp>on a lower level, guile implements "fixing letrec" which tries to turn letrec and letrec* into a series of lets and fixes (where fix is letrec limited to lambda's for the values)
<ijp>it's kind of hard to give a simple example of how that plays out though
<didi>ijp: Thank you. I found a paper about "fixing letrec". I'm intrigued by this. Not many implementations do this. And even by reading the docs for "letrec*" doesn't explain it to me.
<ijp>well, letrec* says "Similar to `letrec', except the INIT expressions are bound to their variables in order."
<ijp>which is basically it
<ijp>the "fix"ing is an implementation detail
<didi>Evaling (let ((a 1)) (define (f x) (define b (+ a x)) (define a 5) (+ a b)) (f 10)) gives 20 in Guile.
<didi>Even if it uses `letrec*', it somehow rearranges the `define' expressions into the right order.
<ijp>sure
<ijp>in that case though, it's all done in the optimiser
<ijp>scheme@(guile-user)> ,optimize (let ((a 1)) (define (f x) (define b (+ a x)) (define a (read)) (+ a b)) (f 10))
<ijp>$4 = (let ((b (if #f #f)) (a (if #f #f))) (begin (set! b (+ a 10)) (set! a (read))) (+ a b))
<ijp>in that case, it is faithfully translated
<ijp>I suppose you could say that the optimiser shouldn't try to be clever in the above situation, but the manual says the behaviour is unspecified
<didi>ijp: Ah, it errors with your `read' expression. Interesting.
*youlysses thinks he's going to hop-back into SICP tomorrow. :^)
<didi>So Guile uses (if #f #f) to produce #<unspecified> values, eh.
<didi>Well, the optimizer at least.
<ijp>that is how guile defines it
<didi>oic
<ijp>from (ice-9 boot-9): (define-syntax *unspecified* (identifier-syntax (if #f #f)))
<didi>Interesting stuff.
<youlysses>Oh wow, davexunit seems to have made pretty steady/strong progress on guile-2d thus-far... :^)
<youlysses>wingo: o/
<wingo>moin
<nalaginrut>is there anything like toPrecison(1) in JS for (0.1+0.2) ?
<mark_weaver>good morning wingo!
<nalaginrut>I mean limit the precision of a float
<mark_weaver>(define (to-nearest-tenth num) (/ (round (* num 10)) 10))
<nalaginrut>thanks, I see how to implement it
<mark_weaver>unfortunately, 1/10 written in binary is an infinite string of digits, like 1/3 is in decimal, so there will inevitably be roundoff errors when working with tenths.
<nalaginrut>why not add it
<mark_weaver>if you want to avoid it, then do your arithmetic using exact rationals.
<mark_weaver>why not add what?
<nalaginrut>real-to-precision or something like
<wingo>morning mark :)
<nalaginrut>morning wingo!
<wingo>mark_weaver: did you see the things i wrote to you in the channel while you weren't there yesterday? ;)
<wingo>i know you usually read the backlogs, but still, thought you might be interested
<wingo>moin nalaginrut :)
<mark_weaver>nalaginrut: that proposal is too vague for me to say much about, but IMO, by the time you generalize it for arbitrary radix and arbitrary precision, then it becomes more complex and less efficient. and what you need here is trivial, anyway. I don't think it's worth it.
<mark_weaver>wingo: I saw the "Register Allocation by Puzzle Solving" paper you cited, and added it to my reading list. That's the only bit I remember. Maybe I missed something?
<wingo>mark_weaver: yep, that was all
<mark_weaver>thanks, I'll check it out at some point. at the moment, I'm trying to make some progress on making Guix boot.
<wingo>cool
<nalaginrut>mark_weaver: alright, for most needs, we don't have to get an arbitrary precision round
<mark_weaver>nalaginrut: also, note that 'format' allows you to specify how many digits to print past the decimal point.
<mark_weaver>but don't ask me for the exact syntax; I always forget.
<nalaginrut>yes, maybe it's faster to convert string to real
*wingo too
<nalaginrut>mark_weaver: don't worry, I remember how to
<nalaginrut>I'm struggling 'format' these days for Artanis ;-)
<mark_weaver>faster to convert string to real? what do you mean?
<nalaginrut>(string->number (format #f "~4f" 0.22222))
<nalaginrut>dunno, I think it may faster than round&mult=
<nalaginrut>multiply
<nalaginrut>sorry I mean "faster than"
<mark_weaver>well, I won't try that again. hint: don't try to use C-c C-o in an Emacs shell buffer if the output was very huge. even C-g won't stop it.. you just have to wait for ages.
<nalaginrut>fortunately I use xchat
<wingo>morning civodul
<nalaginrut>heya ludo
<civodul>Hello Guilers! :-)
<nalaginrut>seems our continuations are implemented with setjmp/longjmp?
<wingo>that's part of it, yes
<nalaginrut>ah, yes, it stores jmpbuf to continuation struct
<nalaginrut>will current continuation implementation be changed in 2.2? I wonder if it's worthy to read the related code
<nalaginrut>#ifdef
<nalaginrut> void *backing_store;
<nalaginrut> unsigned long backing_store_size;
<nalaginrut>#endif /* __ia64__ */
<nalaginrut>is this C macro proper?
<wingo>this part of the implementation may or may not be changed, dunno
<wingo>sure would be nice to avoid capturing the C stack
<wingo>but users would probably complain
<ijp>aidalgol: so, I've been thinking about how to handle multiple line privmsgs
<ijp>I can see two reasonable ways to do it:
<ijp>1. we allow a message to contain newlines, and just break it ourselves on the back end
<ijp>2. we don't allow it, but we let the user call send-privmsg themselves (perhaps multiple times)
<ijp>I'm more inclined to 2, but this means adding a bot argument to user commands
<ijp>but adding the bot argument is useful for other things too
<aidalgol>I was actually going to implement 1 before you even mentioned the other option.
<ijp>well, technically those options aren't mutually exclusive
<aidalgol>of course
<ijp>how does set! work with @@
<wingo>psyntax handles it
<aidalgol>@@?
<ijp>right, so (set! (@@ (foo) bar) baz) works?
<ijp>aidalgol: the "i'm poking around your privates" operator
<aidalgol>private what? This ain't ruby.
<add^_>aidalgol: unexported stuff from modules
<aidalgol>oh
<aidalgol>got it
<aidalgol>Why is @@ not in the manual's index?
<wingo>submit a patch :)
<aidalgol>I will once I find @@ in the manual.
<ijp>it is in there...somewhere
<aidalgol>I'm semi-distracted atm...
<wingo>use C-s @@ RET
<ijp>6.20.2
<ijp>(info "(guile) Using Guile Modules")
<aidalgol>wingo: I know how to use info. :)
<ijp>i @@ RET
*aidalgol digs up the source.
<wingo>why are we having this conversation then ;)
<aidalgol>ijp: I get "No `@@' in index"
<ijp>works on master
<wingo>really?
<wingo>not for me
<mark_weaver>works for me in master too, but not in stable-2.0
<mark_weaver>from emacs info mode, anyway
<wingo>funny, i wonder what's up with mine
<mark_weaver>maybe a different version of texinfo?
<ijp>is there any way to check whether or not an optional was actually not supplied, vs. having been called with the exact same value as default
<ijp>I suppose I can use case-lambda
<aidalgol>OK, guess it's already fixed in the next release.
<aidalgol>NEXT!!
<aidalgol>wingo: Your machine is possessed by daemons!
<wingo>that is surely the answer :)
<wingo>ijp: would be nice, wouldn't it
<wingo>with the old vm we don't really have that ability at runtime
<wingo>i think with rtl we will, though
<wingo>it's not completely plugged through though
<civodul>ijp: you can do that by just doing (define &default (list 'default!)), using that as the default, and comparing against it with eq?
<aidalgol>It's always the answer. I closed a bug at work just today with the comment, "PC possessed by demons. Had local priest exorcise it."
<ijp>true enough
<aidalgol>ijp: Was you asking about @@ related to the bot, per chance?
<ijp>yes
<ijp>I figured it would be convenient to be able to tell it to turn on/off the debugging output directly
<aidalgol>ah, yes, that would be nice
<ijp>currently my mode of thought is. 1. what do I want to do? 2. can I do it from a plugin 3. If not, expose functionality so I can 4. loop
<ijp>ijpbot: debug
<ijpbot>toggled
<ijp>ijpbot: define guile
<ijpbot>guile definition: deceitful cunning.
<aidalgol>That makes the statement "wingo maintains guile" sound slightly sinister.
<civodul>ijpbot: howdy!
<ijpbot>No such command howdy!
<civodul>hmm
<ijp>he doesn't know much yet
<civodul>:-)
<wingo>that is a deceitful statement ;)
<ijp>ijpbot: debug aidalgol
<ijpbot>option not supported: aidalgol
<ijp>alas
<jmd>Is there a function to unescape shell strings?
<jmd>eg "this\\'x" should become "this'x"
<mark_weaver>it's better to use "system*" so that nothing has to be escaped.
<mark_weaver>escape characters vary somewhat from shell to shell, and depending on the configuration, etc. escaping is a fragile method.
<mark_weaver>oh, _UN_escape?
<mark_weaver>out of curiosity, how is it that you come to need this?
<mark_weaver>I'm having a hard time seeing why you'd ever need that.
*mark_weaver --> zzz
<aidalgol>ijp: What other sanitising should be done on the input to `send-privmsg'?
<ijp>well, I'd double check the rfc to make sure that _no_ bad character is given
<ijp>but unless you wanted to support /me I'd leave it at that
<aidalgol>Oh, duh, the RFC.
<aidalgol>/me is done by make-action
<ijp>yes, that's why I wouldn't add it
<ijp>oh, the other thing would be respecting the IRC line limit
<wingo> https://thoughtstreams.io/glyph/string-trepanation/
<ijp>sounds painful
<ijp>well, neither of these are really good descriptions of what is going on here
<aidalgol>Wait, so what *should* we be doing? That stops after saying what we should *not* be doing.
<aidalgol>What does nospcrlfcl mean in BNF?
<aidalgol>(Section 2.3.1 of RFC 2812.)
<ijp>I'm guessing no spaces, carriage returns, line feeds, but the cl eludes me
<ijp>wel, the bnf is clear enough
<ijp>ah colon
<aidalgol>ah
<aidalgol>Which part of the IRC message is the message part of a PRIVMSGS?
<aidalgol>er...
<nalaginrut>alas, it's hard to give a translation to "windchain", even in English I don't understand what it is
<nalaginrut>seems a new term
<aidalgol>I have no idea what a windchain is.
<aidalgol>What's the context?
<nalaginrut>it's in continuation.c of Guile
<nalaginrut>the old windchain is unwound down to the branching point
<ijp>nalaginrut: break it up as "wind" and chain
<nalaginrut>the windchain is rewound up to the continuation's context
<ijp>as in wind a clock
<nalaginrut>ijp: yes I know it's a chain to be wound
<aidalgol>Oh, that wind.
<aidalgol>I was reading that as wind, as in air.
<nalaginrut>;-P
<aidalgol>bloody English...
<nalaginrut>but I can't find this term anywhere but Guile
<nalaginrut>and unwound/rewound
<ijp>aidalgol: well, the way I look at that article is that textual protocols don't embed well
<ijp>some like xml make provisions for including arbitrary data
<ijp>but for a lot of programs, rather than doing a bunch of escaping, you are better of if the interface is designed to take arbitrary data, rather than a special formatted string
<aidalgol>ah
<ijp>e.g. earlier mark_weaver pointed out system*
<ijp>and basically everyone will tell you to use prepared statements when dealing with sql
<ijp>in my scheme-memcached I use the binary protocol version of memcached for this reason
<aidalgol>scheme-memcached? What's that for?
<ijp>talking to memcached
<ijp>which is an in-memory cache
<aidalgol>I know what memcached is.
<nalaginrut>ijp: what's the status of scheme-memcached? how about using it for keep session active?
<ijp>I owe jeapostrophe for that one; If I hadn't been looking at the racket bindings, I wouldn't have known there was a binary protocol
<aidalgol>ijp: Would memcached help with fsbot lag?
<nalaginrut>does it store objects to dist according to something like LRU?
<ijp>aidalgol: I don't think memory is fsbot's problem
<ijp>nalaginrut: it does no storage to disk
<aidalgol>ijp: Right, I think the problem is BBDB lookups.
<nalaginrut>alright
<ijp>and caches are not good for session data
<nalaginrut>I need a memcached thing but it swap according to LRU
<ijp>the point of a cache is that you don't _need_ it, it's there for speeding things up
<ijp>if you were to flush it, then you'd piss off a lot of people who have to log in again :)
<ijp>nalaginrut: the bindings work just fine, it's just a bit of spit and polish that's needed
<nalaginrut>well, I assumed people won't login repeatedly in short time
<nalaginrut>ok
<aidalgol>ijp: So what would you cache?
<nalaginrut>anyway, the swap will be an option for config
<nalaginrut>in Artanis
<ijp>aidalgol: database lookups are a common one
<nalaginrut>ijp: how about I use guile-redis for session cache?
<ijp>well, that would persist, which wouldn't be as bad
<ijp>but I expect redis folk would give you much the same warning
<aidalgol>ijp: Isn't that what BBDB lookups are?
<aidalgol>Emphasis on "DB".
<ijp>well, in fsbot's case, it'd probably be quicker to just load it into emacs directly
<aidalgol>oh, right
<ijp>but I would have expected bbdb to have just done that anyway
*ijp shrugs
<aidalgol>BTW, I didn't see that nospcrlfcl was defined in that document. >_<
<nalaginrut>oops, h.265 has opensource implementation
<aidalgol>OK, bedtime.
<aidalgol>'night, #guile!
<jmd>Why is it called a "repl" ?
<ijp>read eval print, then loop
<jmd>Oh. I thought it was perhaps an anagram of "perl"
<ijp>no, but that at least one person has pointed out that perl would be a better name if you look at how it's implemented
<ijp>(let loop () (print (eval (read))) (loop))
<ijp>well, guile's is more complicated than that, but you'd expect that
<ijp>but repls have been around a lot longer than perl
*brendyn votes REPL
<brendyn>since it follows evaluation order
<ijp>I don't know what you voted on, since we haven't prepared a ballot
<ijp>poor guy, democraphilia
<jmd>ijp: Yeah. Notice that word has "crap" in the middle
<taylanub>Why not (loop (print (eval (read)))) ?
<taylanub>.oO( Looks like I'm late to the party. )
<brendyn>pronounced la purrr
<stis>evening guilers!
<wingo>hey
<dsmith-work>Morning Greetings, Guilers
<jmd>we're just guiling away the time ...
<zxq9>or "le pear", for French fruit lovers who enjoy using English cognates
<stis>Hmm, a prolog parser in 122 lines of code, neat!
<stis>let's write a compiler