IRC channel logs

2013-11-20.log

back to list of logs

<zzach>Is a define-syntax macro in guile2 always ignored when it is obtained from a file via (load ...) ? Here, it works only when the macro is explicitly written in the main scheme file, but not using load. Or has to be something added to use it from a loaded file?
<mark_weaver>zzach: conceptually, 'load' is a normal procedure, not syntax. it doesn't do anything until runtime, which happens after macro expansion.
<mark_weaver>zzach: if you make it a normal module and use (use-modules ...), then it will work.
<mark_weaver>zzach: alternatively, use 'include' instead of 'load'.
<nalaginrut>morning guilers~
<davexunit>hey nalaginrut
<nalaginrut>heya~
<davexunit>has anyone implemented the observer pattern in scheme?
<davexunit>core guile has hooks, but that's not quite the same thing.
<davexunit>I've written something that uses a hash table to map event types (symbols) to a list of callbacks.
*nalaginrut hasn't had a time for design-pattern in FP...
<davexunit>you mean you have never needed one?
<nalaginrut>davexunit: what's your scenario? IIRC, most of time FP could avoid the so-called design-pattern
<nalaginrut>davexunit: besides, you ignored build-aux in guile-2d? I'm trying to add guile-sdl check, I mentioned it last time ;-P
<davexunit>nalaginrut: what do you mean ignored build-aux?
<davexunit>nalaginrut: my scenario is that I want guile-2d programs to be able to register callbacks for key presses, mouse clicks, and other things.
<nalaginrut>davexunit: build-aux was added to .gitignore
<davexunit>oh.
<davexunit>oops.
<davexunit>should that be checked in?
<nalaginrut>because I want to add guile-sdl.m4 for the check
<davexunit>ah okay
<nalaginrut>and it's added to build-aux in default
<davexunit>unignore it and add it. :)
<davexunit>thanks. my knowledge of m4 is 0 and my knowledge of autotools is very poor.
<nalaginrut>actually it's just some customized macros
<nalaginrut>I know little, but to maintain my own project, I have to learn a little ;-)
<davexunit>I'm quite stumped about what the fundamental data structures for guile-2d need to be.
<nalaginrut>davexunit: do you want me remove build-aux from .gitignore? or just add it force?
<davexunit>remove it
<nalaginrut>well, let's talk about the second topic later, I have to handle the first ;P
<davexunit>I'm about to go to bed anyhow.
<nalaginrut>ok, then have nice dream
<davexunit>thanks for your help
<nalaginrut>design pattern is not an easy thing to talk in a minute ;-D
<nalaginrut>np ;-)
<davexunit>nalaginrut: yeah I know. perhaps some other time. I feel like I really need to hash this out with someone to get it out of my own head and hear some opinions.
<davexunit>later
<nalaginrut>I have to face design-pattern too, you know ORM/MVC is not so easy
<davexunit>yeah, that's tough. you will probably face a similar issue.
<nalaginrut>but I wish I can do it in FP way, if no, I won't insist on avoiding-OO way
<davexunit>I feel like I may have to go the OOP way.
<nalaginrut>it's fine
<davexunit>good night.
<nalaginrut>sometimes I have to boast FP is cooler than OOP, if I can avoid some design-pattern in practical project, it's nice
<nalaginrut>oops
<nalaginrut>night
***fangism is now known as fangism-ctrl-Z
***haroldwu_ is now known as haroldwu_jog
***haroldwu_jog is now known as haroldwu_
<civodul>Hello Guilers!
<wingo>heya civodul :)
<Chaos`Eternal>holy guilers
<Chaos`Eternal>I found a strange behavior of guile: if I put this code (display "XXX") in a test.scm file,
<Chaos`Eternal>here XXX is utf-8 string of some chinese characters
<Chaos`Eternal>and then i run guile test.scm
<Chaos`Eternal>it will output ??? indead the chinese chars
<Chaos`Eternal>but if i ran the code in repl, the chinese chars outputs ok.
<wingo>Chaos`Eternal: that is because the repl does a (setlocals LC_ALL ""), and scripts do not
<wingo>*setlocale
<Chaos`Eternal>but why setlocale LC_ALL "" instead of LC_ALL "zh_CN.UTF-8" ?
<civodul>"" means "current locale"
<Chaos`Eternal>got it
<Chaos`Eternal>thank you both
<dsmith-work>Mornign Greetings, Guilers
<davexunit>morning!
<civodul>howdy dsmith-work
<Fuuzetsu>I don't even write guile~
<civodul>you just wrote "guile"
<wingo>:)
<davexunit>Fuuzetsu: off-topic, but I like the document you put together for projects to contribute to.
<davexunit>thanks for including yon-chan and guile-2d :)
<Fuuzetsu>civodul: damn it!
<Fuuzetsu>davexunit: it's very incomplete and the source is terrible, I'll hopefully add more later. I might even do something visual in GIMP!
<davexunit>ooh :)
<davexunit>I need to do some yon-chan hacking soon.
<Fuuzetsu>Me too but I have a whole field of yaks to shave on top of that
<davexunit>same here.
<wingo>hehe
<Fuuzetsu>Well, I think that guile emacsy thing is still being worked on.
<davexunit>I have guix packages to write and I need to get guile-2d in shape.
<Fuuzetsu>I hope to ditch emacs in favour of Yi in some probably fairly distant futureā€¦ How is guile-2d coming along? I haven't looked at the progress for a while
<Fuuzetsu>I do shill for it when I can!
<davexunit>I *really* need to figure out some of the basic APIs for game state management.
<davexunit>I have rewritten it like 4 times now and it still sucks.
<Fuuzetsu>1. Provide State and StateT with a Monad instance
<Fuuzetsu>2. Done
<davexunit>:P
<Fuuzetsu>(people probably wouldn't like that though ;p)
<Fuuzetsu>Too simple
<Fuuzetsu>Did you try looking at other game libs?
<davexunit>the issue is that generating a new game state every frame will lead to a lot of GC churn.
<davexunit>Fuuzetsu: yes, they all use OOP.
<davexunit>I guess I should just do the same and copy the cocos2d API or something.
<Fuuzetsu>somewhat related: http://www.haskell.org/haskellwiki/Bullet
<shanecelis>davexunit: Hey, I found a nice way to split the job control that I wanted out of coroutine and agenda. http://git.io/rOv7zg
<davexunit>oh neat!
<davexunit>I don't understand the job control but that's still very cool :)
<shanecelis>davexunit: It's basically just a wish I've had for Emacs. C-z to suspend anything that takes too long.
<davexunit>shanecelis: I understand the goal and think it's cool, I just haven't yet understood your implementation
<shanecelis>BBL
<davexunit>bye shanecelis
<davexunit>good work
<wingo>evening
<shanecelis>hello
<dsmith-work>wingo: The recent round of rtl renameing broke some tests.
<wingo>dsmith-work: really? humm
<wingo>ah, those standalone tests that i never run ;)
<dsmith-work>Ive started the bulld again with cached go's rm'ed. But I think it was not finding an objcode module.
<wingo>yep, lemme fix
<wingo>pushed
<shanecelis>davexunit: Love this scheduler in agenda.
<davexunit>shanecelis: :)
<davexunit>glad you like it. a lot of thanks due to Abelson and Sussman for the implementation in SICP.
<wingo>mark_weaver: around? i had another thought about stacks
<wingo>dunno if it is a good idea tho
<mark_weaver>wingo: I have a couple of minutes, sure. what's your idea?
<wingo>ok, so it's geometric expansion, with copying
<wingo>start off with one page, every time you would exceed it, you mmap a new region, copy to it, and continue
<wingo>i was looking at the vm and it seems that copying should be fine
<wingo>regarding shrinking, you can MMAP_DONTNEED at GC if that is appropriate
<mark_weaver>sounds reasonable to me
<wingo>but keeping the virtual space around
<mark_weaver>it didn't occur to me that copying would be okay
<mark_weaver>(I figured there would be pointers into it, or something)
<wingo>i think go does this
<wingo>yeah it does inhibit some optimizations i think
<mark_weaver>if copying is okay, then yes, I think this is a good plan.
<wingo>you can't stack-allocate objects and refer to them diretly
<wingo>*directly
<wingo>i.e. not as an offset from some stack pointer
<mark_weaver>well, if we need pointers into the stack, we could just make them relative to the stack base, or relative to the pointer (if the pointer is on the stack), or something like that.
*wingo still not sure
<wingo>well the issue would be something like (let ((x (cons 1 2))) ((lambda () (cdr x)))
<wingo>assume it does not get inlined (as it does)
<wingo>actually it's better with:
<wingo>well the issue would be something like (let ((x (list 1 2))) ((lambda () (qux (cdr x))))
<wingo>imagine x gets stack-allocated
<wingo>then (cdr x) is also stack-allocated
<wingo>i could imagine cases where you get a pointer to that cdr on the heap -- though still limited to the dynamic extent of the call
<wingo>not an optimization we are likely to do, sure, but something to think about
<mark_weaver>if you can reliably find all the pointers into the stack, then it's also doable even if the pointers aren't relative.
<wingo>heh, true; but the complexity might be too much
<mark_weaver>*nod*
<wingo>it could be O(n) in your heap size
<mark_weaver>well, it's already O(n) to do the copy
<wingo>O(n) in the stack size, yes, though you are likely to get good locality there
<mark_weaver>but if you expand geometrically, that's still okay asymptotically, I think.
<wingo>right, i would hope so
<wingo>i bumped the stack size in master to 256K elements because I was getting some stack overflows, in that stressful intermediate state of a few weeks ago
<dsmith-work>wingo: (yep, make check passed)
<wingo>now i want to shrink it but still allow big stacks (but also fix whatever strange compiler thing was using so much stack)
*mark_weaver has to go afk for a while. good luck mulling it over :)
<wingo>otherwise that's 2MB allocated in every guile process, which ain't good for the bloggy benchmarks ;-))
<wingo>heh, tx
<wingo>ciao :)
<mark_weaver>would you ever have pointers from heap allocated cells into stack allocated cells?
<mark_weaver>I'm a bit rusty on this, but I'd think not.
<wingo>mark_weaver: i could imagine that occuring in some kind of stack-allocated-cell optimization
<wingo>but that is such a tricky optimization that i doubt we would get it right
<mark_weaver>I'd think that you could only allocate a mutable object on the stack if you can prove it won't escape. and once it's on the heap, forget that.
<wingo>replacing compound data structures with their parts (scalar replacement) is very doable tho
<wingo>i just don't know of cases when i'd want a stack-allocated object instead of the components of the object
<wingo>it seems those cases are precisely those in which you can avoid taking the address of the object at all (as you say)
<mark_weaver>okay, gotta go :)
<wingo>ciao :)
***fangism-ctrl-Z is now known as fangism