IRC channel logs
2016-04-25.log
back to list of logs
<shanemikel>ughhh.. I guess I'm gonna need to define my own error type so I can write a catchall to escape the exception mechanism and get something like an Either GError SCM in haskell <shanemikel>I wonder why there isn't a c_catch function with the handler typed to return void* (like the with_continuation one) <shanemikel>to be more precise, Of course I'm gonna have to define my own error type, but I would rather not define my own error SCM type <shanemikel>any thoughts whatsoever about the exception mechanism, and the most general approach that will allow me to handle all uncaught exceptions nicely with all the behavioral variants? <shanemikel>what's the difference between with_throw_handler and catch_with_pre_unwind_handler? <sapienTech>hi all, trying to install slib-3a3 for guile-2.0.9 following the guide in the guile manual but having some issues. <sapienTech>After (require (ice-9 slib)) and (require 'new-catalog), I get: Unbound variable: list->uniform-array after trying (require 'primes) <sapienTech>the manual suggests i modify ice-9/slib.scm to add define-public for the offending variable, but I can't seem to get that to work <ijp>out of curiousity, what are you using slib for? <sapienTech>looking through the libraries I have, i can't even find a list->uniform-array procedure. Is this a deprecated procedure? <ijp>it doesn't sound familiar <ijp>there are a bunch of procedures for converting to specific kinds of uniform array, but none that are general afaik <ijp>and it wouldn't be removed if it was only deprecated <ijp>maybe it matches one of list->array or list->typed-array <sapienTech>/usr/local/lib/slib/guile-2.init:625:8: In procedure module-lookup: Unbound variable: list->uniform-array is where I'm getting the error <sapienTech>yeah im going around now to see if it matches those <rain1>where is slib maybe we could just take the prime code out <rain1>it seems to be ancient and broken <wingo>paroneayea: why run-delay instead of (sleep) ? <wingo>for me i think i prefer the abstraction to be threads; dunno tho :) <civodul>with (sleep n) = (abort-to-prompt scheduler-prompt (run-request n)) maybe? <lloda>sneek: later tell daviid thx <lloda>sapienTech: it should be list->typed-array. list->uniform-array was redundant and was removed in 2009 according to git <paroneayea>wingo: well I'm not actually doing multiple threads, which is why not sleep! <paroneayea>sleep is blocking on a single threaded application; telling the scheduler to execute this in n seconds isn't, right? <paroneayea>wingo: "why not threads" is basically because I don't want to deal with locking issues, and also I'm miming the systems I know :) <wingo>well, think "goroutines" if you like <paroneayea>wingo: admittedly I don't know much about goroutines! <wingo>i mean a thread is an abstract thing, it might not execute in parallel with other things like pthreads <wingo>like you can have one thread per client on a web server <wingo>but each thread is just a delimited continuation <wingo>that suspends whenever it needs more information from the other party, or the other party hasn't read the information that it sent, etc <wingo>like you should be able to write a "thread" in 8sync that just does (let lp () (sleep 10) (lp)) <wingo>for a suitable definition of sleep <wingo>one that suspends back to the scheduler and arranges to reinstantiate the thread in 10 seconds <paroneayea>davexunit: sly's coroutines run in multiple threads? <davexunit>which is implemented on top of a generic 'yield' procedure which aborts to the coroutine prompt <davexunit>I don't think "thread" in this context means "pthread" <paroneayea>suspending on need of information for the other party <davexunit>how do you specify that you want to wait 10 seconds in 8sync? <paroneayea>davexunit: there's a time delta object made and attached to the run-request <paroneayea>the run-request is the thing that jumps back to the prompt <davexunit>so seems like you can already do what wingo wants, then. <paroneayea>so for most operations, I think 8sync works like the "kind of" threads you're talking about above <paroneayea>but since select / poll / etc already have a "wait for this long" thing <paroneayea>there's a calculation done of "how long do we need to wait for the next thing on the agenda's queue" <davexunit>in sly, there is a parameter for the current agenda. does 8sync also do this? <paroneayea>it's the only "global variable"'ish thing in there <paroneayea>but since it's a parameter, I think it's not so bad <paroneayea>having to pass around the prompt tag seems like it would make code ugly <davexunit>this is the perfect use-case for dynamically scoped variables. <paroneayea>there's only one mutate'y thing in 8sync core iirc too, which is that we use (ice-9 q) <paroneayea>but... I've left things in such a way that I could explore replacing it with a more functional queue like maybe from ijp's pfds library <paroneayea>davexunit: I dunno, if you fold across an immutable queue, does it have to be? <davexunit>I mean, you could do that if it makes the implementation better. <paroneayea>I think the only reason to do it though is if we could get elm-style "replayability", but that would require that a user really really only do functional programming on top of it, and that we record the inputs from ports in a way that can be replayed <davexunit>but we're still dealing with stateful things, there's no way around it. there's a core kernel of imperative code that needs to be there. <paroneayea>it looks like mostly the queue implementation from sicp <paroneayea>so, if someone really does want multiple cores churning away at things to keep things more efficient <paroneayea>I'm hoping by the end of the week to have my actor model subsystem working to the point where you can distribute tasks across processes <davexunit>paroneayea: I intend to achieve replayability at a higher layer than the scheduler in Sly. <davexunit>and associating each objects with a time stamp <paroneayea>I guess I won't worry too much about using a mutable queue in 8sync then :) <davexunit>I wouldn't until it becomes apparent what a win would be. <davexunit>I implemented a functional queue awhile back <paroneayea>but I found a paper about functional queues and I was like "is this you?" <civodul>davexunit: i don't think scheduling is "inherently imperative", it's just about shuffling queues around no :-) <davexunit>civodul: there's some amount of state to maintain <ArneBab>paroneayea: you tutorial is fun to read. It might be stronger, if it included parts of the output to show what a reader can expect to see. <civodul>davexunit: right, but the scheduler is a function that takes a state and an event and returns a state :-) <random_nick>I remember reading some article about how C is a purely functional language <random_nick>no one who knows what C is and what purely functional programming is can claim that seriously <davexunit>conal elliot's writing rubs me the wrong way <davexunit>he coined the term "functional reactive programming" <davexunit>and then got upset when other people started making different takes on it and calling it FRP <df_>I think it makes a reasonable point, eg the state monad is basically recreating imperative programming in a more formal way <davexunit>I use monads all the time to create a functional layer on top of an imperative system <paroneayea>guile why do you think I've redefined this struct when I haven't <paroneayea>* Original key 'wrong-type-arg and arguments: (#f "Wrong type to apply: ~S" (#<syntax-transformer mes <rekado>I want to monkey-patch a private procedure in (web http). It uses a macro defined in (web http). To redefine the procedure with "module-set!" I'd also need to access the macro. <rekado>is there a way to access a macro with the (@@ (web http) ...) syntax? <rekado>or is there something comparable I could use? <random_nick>is there a recommended way for getting values out of a closure's environment without calling it? <davexunit>you can't reach into a proceure's environment. <random_nick>yeah but those who explicitly reference these variables? <mark_weaver>random_nick: local variables can only be accessed from within their lexical scope <mark_weaver>and the compiler makes use of this, e.g. if a variable is never 'set!' from within the scope then it can assume that its value never changes, and it can even be optimized out completely <mark_weaver>however, what *is* possible is to create one or more procedures from within the lexical scope, and make those procedures available to the outside somehow <mark_weaver>e.g. (cons (lambda () VARIABLE) (lambda (value) (set! VARIABLE value))) <mark_weaver>guile comes with a macro called 'the-environment', which captures a lexical environment, and it works by automatically creating procedures like this <mark_weaver>and you can pass the result of 'the-environment' to 'local-eval' to evaluate arbitrary expressions within that environment <mark_weaver>but beware the using 'the-environment' within a lexical environment will greatly hinder what our optimizing compiler is able to do with that code <mark_weaver>because it must assume that the variables might be mutated at any time from the outside <random_nick>forgot about the-environment and that upvalues can be more than one up <wingo>ACTION plugging ahead at port refactor branch; done soon <wingo>though threadsafety without types is pretty hard :/ <wingo>almost anything in a critical section can throw; you end up needing dynwinds all the time if you provide serialization guarantees that cover more than a single mutable field <civodul>wingo: but dynwinds are cheaper in 2.2, no?