IRC channel logs

2016-03-08.log

back to list of logs

***M-TimePath is now known as M-TimePath1
***M-TimePath1 is now known as TimePath`
***TimePath` is now known as M-TimePath2
***M-TimePath2 is now known as TimePath`
<callcc>how similar is guile to scheme?
<callcc>does it hve callcc? continuations
<paroneayea>callcc: it has call/cc and continuations and even delimited continuations
<paroneayea>and it *is* a scheme
<callcc>does it have eval? like how should i picture that? the scheme wiki says scheme implemented it later via environment?
<callcc>nvm
<paroneayea>callcc: the manual gives a nice intro to these things
<callcc>yea imean after reading through so many lisp implementations. you kinda lose a bit of hope.
<callcc>but it looks like guile is what im looking for.
<callcc>hope/energy
<callcc>how do you get the environment with a let?
<paroneayea>callcc: I don't know what you mean?
<callcc>paroneayea: http://pastebin.com/tMMYYjZy
<callcc>im trying to do some artanis, but i get unbound variable "the-environment"
<paroneayea>callcc: (use-modules (ice-9 local-eval))
<paroneayea>to get (the-environment)
<paroneayea>I'm not sure passing around an environment like that is the best way to go, but maybe that's the artanis way
<callcc>oh thanks, i think its just a example and your supposed to make your own environments
<callcc>which makes sense if your talking about templating
<callcc>how do i load a module locally current file?
<callcc>i(use-modules (search-path "./" "website" (".env")))
<callcc>like find a file then load the module in it.
<mark_weaver>callcc: use 'load' for that, not 'use-modules'
<callcc>oke but where does it get loaded, can i get a handle on it?
<callcc>at runtime?
<callcc>mark_weaver: .
<callcc>like i just want a handle to the files environment. load it, put in a variable.
<mark_weaver>if the file starts with a 'define-module' form or equivalent, then that module is where the bindings will go. if not, then it gets loaded into whatever is the 'current-module'.
<mark_weaver>if you prefer, you can create a fresh module dynamically and then load the file into it
<mark_weaver>see section 6.19 (Modules) in the Guile manual
<mark_weaver>and section 6.17 (Reading and Evalutation Scheme Code)
<mark_weaver>*Evaluating
<mark_weaver>a module can be passed as an environment to 'eval' or 'local-eval'
<mark_weaver>regarding "put it in a variable", modules are first-class objects that can be bound to variables
<mark_weaver>one warning though: modules can't be garbage collected, unfortunately
<mark_weaver>at least not given our current implementation
<mark_weaver>(although, if needed, all the bindings in the module could be black-holed, which would free up most of the memory anyway)
<callcc>when i '(define-module (custom-environment))' then load the file that contains that custom environment?
<callcc>i cannot reach (custom-environment) the module itself
<callcc>in the local environment.
<callcc>thats my problem
<callcc>i hate the global state magic thinking stuff going on. why not just say any file is a anonymous module/environment. if you load it. it returns that environment. your tasked with holding a reference into the local environment.
<callcc>kiss
<nalaginrut>M$ announced SQL-server for Linux, without revealing any code, I don't think Artanis will support it
<callcc>sounds sketchy as hell
<mark_weaver>callcc: I agree that would be ideal, but unfortunately our macro expander and compiler keep references to modules by name only, so the GC can't see those references
<mark_weaver><callcc> i cannot reach (custom-environment) the module itself
<mark_weaver>callcc: what do you mean exactly? can you show me what you tried and what went wrong?
<callcc>(load "theme/website.env") if that file has a define-module custom environment
<callcc>how do i get it from wherever i load
<mark_weaver>use 'resolve-module'
<callcc>on what?
<callcc>the string
<mark_weaver>the name of the module
<mark_weaver>which is a list of symbols
<mark_weaver>ae.g. (resolve-module '(ice-9 match)) returns the module object for the (ice-9 match) module
<callcc>oh
<callcc>:(
<mark_weaver>or, you can omit the 'define-module' from the file, and create a new module with an auto-generated name, maybe using gensym
<mark_weaver>and then make it the 'current-module' while loading the file
<mark_weaver>see 'current-module', 'set-current-module' and 'save-module-excursion' in section 6.19.8 of the manual
<callcc>yea idk man, this smells funny.
<mark_weaver>I agree it's not as elegant as one might hope for
<callcc>i think the problem lies in the fact were actually talking about 2 seperate things here, a module sits inside a file. so if you load the file your actually supposed to load a anonymous module. then if you create module Foo inside file. your supposed to have 2 nested environments. File -> Foo
<callcc>idk
<mark_weaver>the way it actually works is that 'define-module' is a macro that sets the "current-module" as a side-effect. current-module is a "fluid" variable, i.e. a thread-local dynamically-scoped variable
<mark_weaver>this causes any following expressions and definitions to be evaluated within the context of that module
<mark_weaver>when the module auto-loader reads a file, as I recall it creates a fresh module to start evaluating the file's expressions within, with the expectation that a 'define-module' form or similar will be present at the top of th efile.
<mark_weaver>when you write "supposed to" above, are these your personal judgments of how things ought to work, or something else?
<callcc>well i dont know if you could call more modern developments authorative against older software.
<callcc>but like compared to $vau/fexpr. https://en.wikipedia.org/wiki/Fexpr
<mark_weaver>out of curiosity, what systems are you referring to that handle this more elegantly?
<callcc>$vau
<callcc>fexpr
<callcc> http://gliese1337.blogspot.com/2012/04/schrodingers-equation-of-software.html
<callcc>makes for a good read as to how its totally amazeballs
<callcc>basically how you do eval right now, but i dont think its based on that.
<mark_weaver>well, I agree that we could do better here, and I'm sorry to disappoint.
<mark_weaver>we might be able to fix it at some point, with some work
<callcc>are you a maintainer of guile ?
<mark_weaver>one of three maintainers, yes
<mark_weaver>but I'm not responsible for these limitations :)
<callcc>oh thats awesome.
<callcc>you never heard of the kernel language?
<callcc>which is where the whole $vau things come from i guess, idk exactly. https://web.cs.wpi.edu/~jshutt/kernel.html
<mark_weaver>I don't remember if I ever came across it, I've read about many languages over the last 20 years or so
<mark_weaver>it sounds vaguely familiar :)
<mark_weaver>anyway, I have to go afk for a while. happy hacking!
<callcc>ty i will
<civodul>Hello Guilers!
***karswell` is now known as karswell
***M-TimePath is now known as M-TimePath1
***M-TimePath1 is now known as TimePath`
<amz3`>héllo guilers :-)
<amz3`>I just figured that in my eventloop module async.scm, it needs to be able to unregister reader/writer callback
<amz3`>I did not test, what happens when the other end of the socket was closed prematurely
<davexunit>ACTION started hacking on a Linux GPIO library last night
<rain1>excuse if a silly question but GPIO? like for microcontrollers or something different?
<davexunit>rain1: yeah, General Purpose Input Output
<rain1>that's cool!
<davexunit>boards like the Novena and Raspberry Pi have GPIOs on them.
<davexunit>and Linux provides a userspace interface to them in the file system
<davexunit>/sys/class/gpio
<davexunit>and the API is really small, so it won't take much time to bang out a basic Guile interface for it.
<davexunit>I'm just limited on time in which I can sit at my Novena and do the hacks.
<rain1>oh the Novena!
<rain1>those are sooo cool
<rain1>I read thath guix is going to use them for build servers or something
<davexunit>we already have 1 or 2 of them in use in our build farm
<rain1>It has an FPGA unit in it, doesn't it?
<davexunit>rain1: yes.
<davexunit>but there is no free toolchain for it, so I do not use it.
<rain1>ah that's a shame, there was a recent CCC talk on free toolchain FPGA work
<rain1>maybe it will be possible soon!
<davexunit>I took some baby steps to join in on a reverse engineering effort, but it turns out that you can produce a bitstream that programs the FPGA in such a way that it shorts power to ground
<rain1>that's scary!!
<davexunit>so once I learned that I stopped.
<rain1>I'm always worried about burning out the pins of a MCU, burning an FPGA is about 50x worse
<davexunit>because I really don't know what I'm doing, and the price for stumbling through is too high.
<rain1>yeah absolutely