IRC channel logs

2013-09-14.log

back to list of logs

<mark_weaver>ArneBab_: what's the wisp rule for dealing with tabs?
<ArneBab_>mark_weaver: I do not accept them as indentation, because they create tons of problems in python.
<ArneBab_>python3 actually switched to making it an error to use tabs and spaces for indentation in the same file: either one or the other.
<mark_weaver>ah, good.
<mark_weaver>so if you see a tab before any non-whitespace, that's an error?
<mark_weaver>(I'm working on another wisp implementation)
*dsmith-work sighs
<ArneBab_>I’d treat it as an error, yes.
<ArneBab_>cool!
<ArneBab_>you can already use the *.w files in the wisp-repo as test-files: https://bitbucket.org/ArneBab/wisp
<ArneBab_>though the hardest testcase will likely be wisp-guile.w ☺
<mark_weaver>ArneBab_: thanks
<ArneBab_>the files are in examples/ and tests/ — the former lists working code (though small) while the latter has some specific testcases.
<ArneBab_>the tests do not only contain scheme, though: Some are written for emacs lisp.
<ArneBab_>the examples on the other hand are all guile scheme
<ArneBab_>(except for example.w - I’ll move that out…)
<ArneBab_>moved
<ArneBab_>now all examples/*.w should be guile scheme.
<mark_weaver>sounds good :)
*ArneBab_ needs to go to bed, now.
<ArneBab_>Happy hacking!
<mark_weaver>okay, sleep well!
<ArneBab_>thanks!
<ArneBab_> cu
<nalaginrut>morning guilers~
<mark_weaver>hi nalaginrut!
<nalaginrut>mark_weaver: heya~
<nalaginrut>mark_weaver: I read the code more carefully, I think it covers request-compare
<nalaginrut>the problem is when we add #:body request-body, we have to modify the test string
<nalaginrut>by adding these two lines:
<nalaginrut>Content-Length: 0
<nalaginrut>Content-Type: text/plain;charset=utf-8
<nalaginrut>it should be in the expect request headers
<nalaginrut>and check-transaction pass "" as body in default
<nalaginrut>then it covers the situation you just fixed
<mark_weaver>makes sense.
<nalaginrut>I'm testing
<mark_weaver>thanks for working on this :)
<nalaginrut>np ;-P
<nalaginrut>the only question for me is that GET seems need these two lines either, does it make sens?
<nalaginrut>sense
<nalaginrut>try (http-get "http://www.apache.com" #:port (current-output-port) #:body "")
<nalaginrut>this calling breaks as expected, what I want to say is the require-header it print out
<mark_weaver>I'm sorry, I don't understand what you're saying. but I was hoping that you could mostly do this job on your own. If I have to give you a lot of help to do it, it might be easier for me to just do it myself.
<nalaginrut>alright
<nalaginrut>mark_weaver: I have to mention that GET shouldn't include content-length & charset, but the current http-get does
<nalaginrut>actually, according to RFC, it's MUST NOT
<mark_weaver>nalaginrut: the reason is because #:body "" is being passed to http-get, but it should.
<mark_weaver>well, maybe not. I haven't looked closely. but that's my guess.
<nalaginrut>doesn't http-get has the duty to ignore the body? (I know it's hard for our current implementation)
<nalaginrut>when there's body passed in, it generates content-lenght
<nalaginrut>A message-body MUST NOT be included in
<nalaginrut>a request if the specification of the request method (section 5.1.1)
<nalaginrut>does not allow sending an entity-body in requests.
<nalaginrut>then content-length 0 should be avoid too
<mark_weaver>I just tried, and I see that 'http-get' only generates Content-Length and Content-Type headers if a #:body is passed in.
<mark_weaver>I guess we could make things more strict, perhaps.
<mark_weaver>unfortunately, this web code pretty consistently conflates "no body" with "empty body".
<nalaginrut>though send content-length in GET may get correct response, as I know it could be blocked by some firewall for exploit purpose
<mark_weaver>nalaginrut: for purposes of the test suite, I think perhaps the solution is to change "" to #f in the 'request-body' argument to 'check-transaction', where appropriate.
<nalaginrut>OK
<nalaginrut>I'll try
<nalaginrut>ok this solved
*nalaginrut doing others
<mark_weaver>excellent!
<nalaginrut>hmm...seems OK now
<nalaginrut>mark_weaver: https://gist.github.com/NalaGinrut/6558650
<nalaginrut>wait, I have to confirm that if DELETE receive entity...
<nalaginrut>alright, it could... (RFC is vague)
<mark_weaver>nalaginrut: do you know how to use 'git' to commit these changes to your local tree, and then use 'git format-patch' to generate a diff suitable for emailing to us?
<mark_weaver>I guess you must, since you have artanis in github :)
<nalaginrut>I know how to format patch with git
<nalaginrut>IIRC you have reviewed my other patch
<mark_weaver>I had forgotten the details of how you sent it in.
<mark_weaver>anyway, if you'd like to email us the patch when it's ready, that would be very helpful :)
<nalaginrut>add -> commit -> format-patch, it's my way, the only problem is I never sent them with git, but attached to a mail
<mark_weaver>nalaginrut: oh wait. I see that "PUT" and "POST" don't include anything in the body.
<mark_weaver>it would be good to add tests where they have a non-empty body.
<nalaginrut>of course, let me check the patch more carefully
<mark_weaver>and the request body should be checked by the tests, to make sure it was actually sent properly.
<nalaginrut>OK, it's reasonable, since "" won't count size
<nalaginrut>mark_weaver: done, add a predefined body test for POST/PUT
<nalaginrut> https://gist.github.com/NalaGinrut/6558650
<mark_weaver>could you paste a diff? it's hard to me to see what you did.
<nalaginrut>OK
<nalaginrut>mark_weaver: https://gist.github.com/NalaGinrut/6558837
<mark_weaver>nalaginrut: looks good to me! :)
<mark_weaver>thanks~
<nalaginrut>;-)
<nalaginrut>hmm..sorry I forget remove the debug code
<nalaginrut>ok now
<mark_weaver>would you like to email it to guile-devel for final review?
<mark_weaver>well, take your time. I need to sleep now. (I know, it's early for me :)
<nalaginrut>have a nice dream ;-P
<mark_weaver>happy hacking!
*mark_weaver --> zzz
<stis>evening folks!
<davexunit>hello1
<ijp>hey
<davexunit>hello!*
<foeniks>hi
<foeniks>I use (run-server) from the web packages
*ijp has an almost working thompson-bugged compiler
<foeniks>using stuff from the manual
<foeniks>added a small handler for URI paths
<foeniks>now I realized that this works until I load the second page
<ijp>do you have an example?
<foeniks>sorry I got disconnected
<foeniks>hmm
*ijp cackes insanely
<ijp>cackles*
<ijp>mark_weaver: http://shift-reset.com/tmp/code.tar
*mark_weaver looks
<ijp>that is not why I am cackling insanely though, what I'm doing is much more mad
<mark_weaver>heh
<mark_weaver>To answer the question you posed in the code: I don't know of any universal thompson-bugged compiler. As far as I know, the best it can do is to look for some pattern in the code that's unique enough to not be found elsewhere, and replace.
<mark_weaver>well, the best we currently know how to do, that is.
<mark_weaver>but I guess I should s/we/I/ :)
<ijp>I figure that for C or haskell, or something with main, that's at least a "hook" you will always find
<ijp>but that depends on not being separately compiled
<mark_weaver>yeah, but even so, what can you do in main that will work universally?
<ijp>well in both those cases, the module system could prevent IO functions being imported, so not a lot
<mark_weaver>if the compiler is compiling itself, then what will you do at main that will insert a bug into that compiler?
<mark_weaver>ijp: I assume you know of David Wheeler's solution to the thompson virus? (same David Wheeler that produced SRFI-105 and SRFI-110)
<ijp>the obvious solution is check the code after you compiled it
<ijp>but I hadn't gotten around to reading wheeler's solution yet
<mark_weaver> http://www.dwheeler.com/trusting-trust/
<mark_weaver>checking the code is not practical for any non-tiny compiler.
<ijp>I'll link you to my other insanity in a moment
<ijp>hmm, I've just accidentally came up with a novel implementation of reverse
<ijp>(define (reverse* ls) (cdr (fold-right (lambda (x y) (cons (cdar y) (cons (caar y) (cdr y)))) (cons ls '()) ls)))
<ijp>it's more efficient than the usual reverse done with fold right, because although it does two passes, it's still linear
<ijp>of course, it's really faking the left fold version
<mark_weaver>heh, the proc passed to fold doesn't reference 'x' at all. it just relies on being called N times where N is the length of LS.
<ijp>much like the way you'd do 'length'
<mark_weaver>I'm actually not that fond of 'fold' as a universal iterator. It seemed like a great idea when I first heard it, but there are too many cases where it's extremely awkward to use.
<mark_weaver>though of course I like to use 'fold' where it works well.
<mark_weaver>most notably when you need to traverse multiple lists at the same time, at different rates. I know that it's possible to make this work with continuations, but it's awkward.
<ijp>well, it is cool that it's universal, but very easy to abuse
<taylanub>`let/ec' is implemented simply via a prompt-handler that doesn't use the continuation-argument it receives. This probably doesn't prevent `abort-to-prompt' from moving some stack-frames to the heap, right ? So `let/ec' is not nearly as efficient as e.g. a plain break/return/goto.
<mark_weaver>taylanub: that's a question for wingo
<mark_weaver>however, I don't think that 'abort-to-prompt' should have to copy anything to the heap for an escape-only prompt.
<mark_weaver>but it's certainly not as efficient as C's break/return/goto, that's for sure.
<taylanub>Right .. I didn't know how to express it; let the question just be "does it always heap-allocate or not".
<mark_weaver>there's plenty of room for improvement though. in the RTL compiler, wingo plans to have a compiler pass that optimizes local prompts, which would effectively turn some of them into the equivalent of break/return/goto.
<taylanub>Neat!
<stis>yey!
<mark_weaver>ArneBab: although it's not spelled out in your wisp spec, I guess from looking at the examples that one blank line is not enough to close all the brackets. two blank lines are needed to do that. but what about lines with just comments in them?
*stis realizes that renaming of macros can be tricky if you use (syntax-rules (my-macro-here) ...)
<ijp>well, that's the argument for always binding syntax literals
*stis yes that's the reason, I'm fixing it now, thx
<mark_weaver>stis: no, because the first element of a syntax-rules pattern is always ignored.
<mark_weaver>oh, you mean where the macro name is in the literals list?
<stis>yep, and then you rename, was unsure how this will work
<stis>debugging some issues regarding this right now!
<mark_weaver>literals are matched using 'free-identifier=?', which boils down to this: either the two identifiers must have the same binding, or they must both be unbound.
<mark_weaver>s/both be unbound/both be unbound and have the same name/
<stis>both ar bounf to the same object but different names, can this lead to free-identifier?= #f?
<stis>looks like it
<stis>define a #'GL:<cut>)
<stis>define b (vector 'syntax-object '<cut> '((top)) '(hygiene logic guile-log)))
<stis>(free-identifier=? a b)
<stis>#f
<stis>also verified that a and b is both bound!
<stis>anyway I can solve this, syntax-local-binding will rescue me
<stis>mark_weaver: I know that you are paging in psyntax right now,
<stis>racket has some constructs where one can supply the function used to compare litterals
<mark_weaver>well, you can do it manually using a syntax-case guard also.
<stis>to e.g. syntax-rules and syntax-case, woudl have been nice to use such a featur to solve my issue
<mark_weaver>stis: syntax-local-binding? ugh.
<mark_weaver>stis: it would be better not to use that unless you really have to.
<stis>yep, thats true, I think I back on that :-)
<mark_weaver>stis: what are you trying to do exactly?
<stis>I used a mapping from syntax objects to property.
<stis>worked like free-identifier by first using a hash on the symbol name
<mark_weaver>note that it's not enough for the two identifiers to be bound to variables that hold the same value.
<mark_weaver>they actually have to be bound to the same variable.
<mark_weaver>i.e. such that using 'set!' on one will cause the other to change as well.
<ijp>i.e. (eqv? (module-ref m1 'foo) (module-ref m2 'bar))
<mark_weaver>stis: I accomplished that in srfi-9. see 'define-tagged-inlinable' in srfi-9.scm
<mark_weaver>it allows a compile-time lookup of a set of key-value pairs.
<stis>Yea I needed to kick out that solution, and use the binding to compare in stead.
<stis>so essentially in a macro, when I have a syntax object I need to find which property it refers to e.g.
<stis>it has to be bound and the macro transformaer must be in a hashlist in order to have the property
<stis>e.g. beeeing a macro that is.
<mark_weaver>it's the basis for how functional setters are able to generate optimal code. each SRFI-9-defined getter is an inlinable procedure, i.e. macro. it includes a set of key-value pairs, allowing the type, index, and copier of any getter to be looked up at macro-expansion time
<stis>YesI need excactly this behavior!
<stis>byt in stead of getter I have #t
<mark_weaver>study 'define-tagged-inlinable' in srfi-9.scm.
<stis>cool!
<mark_weaver>much of the code that uses it is in srfi-9/gnu.scm
<stis>I think that something like this woudl be a schemisches way to have CL's get and put in scheme
<mark_weaver>stis: 'make-object-property' is my preferred analogue to 'get' and 'put'
<stis>Yeah, that's what I''m afeer basically, if it's bounded!
<mark_weaver>bounded?
<stis>if a symbol have not been defined what to do then!
<stis>e.g. there is no object!
<mark_weaver>well, for 'define-tagged-inlinable', that's what the (%%on-error err) stuff is all about.
<stis>cool, I'll dig into that code soon.
<mark_weaver>see 'getter-copier', for example. if 'getter' is not actually a macro, then it's assumed by the expander to be a procedure call, and the (%%on-error err) will be expanded.. and that generates a proper error message.
<stis>anaway for a (put a 'x 12), essentilly cons the syntax object #'a with the value on list
<stis>at (get a 'x #f) walk the list again and use free-identifier?= for matching and finding the value
<mark_weaver>well, 'define-tagged-inlinable' doesn't allow things to be added later. all the key-value pairs must be provided when the getter is defined.
<mark_weaver>I don't see a sane way to do mutable property lists at expansion time, given that things might be compiled in different Guile sessions.
<stis>mark_weaver: The semantics to head for is that assuming that expansions in live code as well.
<stis>If we can reach that goals is another question. But first onen eed to decide on a sane goal
<mark_weaver>stis: I'm sorry, I can't make sense of what you just wrote.
<stis>Some good semantics to long for, that looks and behaves natural at the source code level.
<mark_weaver>how can you mutate code that has already been compiled into a .go file?
<mark_weaver>where would this mutable property list be stored?
<stis>But with respect to implementation that goal can be hard e.g. we want to precompile and not evaluate each macro at each evaluation
<stis>mutation is hard, mybe threadding will bite you etc etc.
<ijp>mark_weaver: hows your continued fractions code coming along?
<stis>But when I write (put a 'x 12) I have a definite feeling that it should just associate what a associates to in the code
<stis>I think that one need to start making that precise.
<stis>or design alternative goals as well!
<mark_weaver>ijp: I haven't worked on it in a while. It can compute the basic four operations (+ - * /) on arbitrary continued fractions, compute exact square roots of rationals, compute a number of mathematical constants, and a few other things.
<mark_weaver>ijp: I got hung up trying to compute 'exp' of arbitrary continued fractions.
<mark_weaver>ijp: I found a paper for computing logarithms of continued fractions, but haven't yet implemented it.
<ijp>cool
<mark_weaver>ijp: and then there's a thorny issue that the comparison operators (= < > <= >=) are not guaranteed to terminate. and in fact, even computing the continued fraction of a rational number that's derived from irrationals will often not terminate.
<ijp>you'd get termination if you did it to within a tolerance, right?
<ijp>assuming the tolerance isn't an infinitely long
<mark_weaver>well, consider computing (- *pi* *pi*)
<mark_weaver>let's say you want the answer to within 0.01
<mark_weaver>but you can't even decide what the first term should be..
<mark_weaver>you can do it with continued fractions if you return a lower and upper bound. basically interval arithmetic.
<mark_weaver>or if you somehow change the representation to cope.
<mark_weaver>anyway, nonetheless it can be used to compute infinite streams of many things.
<mark_weaver>but it's a lot slower than my earlier GOOPS-based arbitrary-precision arithmetic code was. (which *did* implement all of the operations, and passed numbers.test)
<mark_weaver>I never published it because I was embarrassed at some of the naivete I showed in my float-point code.. I really need to rewrite it.
<mark_weaver>the nice thing about continued fractions is that if it doesn't hang, it's guaranteed to produce exactly the right answer.
<mark_weaver>no worries that you didn't compute enough extra digits at the end, and no headaches with computing worst-case error bounds during your computations.
<ijp>I find it odd that it took humanity so long to start taking interval arithmetic seriously
<ijp>I suppose without calculating machines it didn't matter that much
<mark_weaver>yeah, it's too bad. it's still relatively inefficient to do interval arithmetic, because changing the rounding mode tends to be a relatively inefficient operation.
<mark_weaver>I guess the reason is that, in practice, computing a few extra digits tends to work well most of the time.
<mark_weaver>of course it blows up in your face if you're wrong about how many extra digits are needed.
<mark_weaver>but I guess MPFR and MPC did the hard work there.
<stis>mark_weaver, if you like you can see my take on get and put in ...
<stis> http://gitorious.org/guile-cl/guile-cl/source/919ac0a07551a8e437793bc19c8834d2d390b91c:compat/cl/symbol-property.scm
<stis>it's not thread safe though
<ijp>for symbols, we still have old style symbol property lists
<ijp>we do recommend against using them though
<ijp>and OMG gitorious is pretty now
<ijp>I suppose that's another site fallen prey to twitter bootstrap
<stis>yea ijp: we have that for symbols, but symbols in scheme is pity compared to symbols in lisp e.g. modules are not included
<ijp>right, modules have a separate namespace
<stis>I tried to include modules in a sane way as well
<stis>Still my approach may be insane ;-)
<ijp>well, you've made it syntax, which kind of limits some of the uses of it
<mark_weaver>stis: the indentation is messed up
<ijp>I was just away to say
<stis>yah lambda*
<stis>arounfd there, fixed!
<stis>around there, fixed!
<mark_weaver>stis: I think I would just use 'module-variable' to get the variable associated with a binding, and then use that as the key for your lookup. Guile's variables correspond roughly to CL's symbols, I think.
<mark_weaver>of course, that has to be done at runtime, not compile time.
<mark_weaver>but then, 'get' and 'put' are run-time procedures in CL.
<mark_weaver>stis: I'm talking about bad indentation in 'get-var', btw.
<stis>yeah with-syntax, I tried to push it to the left to not expand too much to the right.
<mark_weaver>stis: you're mutating *random-state* in here, every time you expand 'get-var'. ick.
<stis>:-)
<mark_weaver>stis: you know that you can pass a random state as the second argument to 'random', right?
<mark_weaver>you don't have to mutate the global one.
<mark_weaver>s/mutate/set!/
<stis>yes, I have not gont theat far yet, but I uused that trick oin other places!
<mark_weaver>the bad indentation makes it very hard to read this code :-(
<stis>That's a good fix about the random state that is
<mark_weaver>you're accessing the internal data structure of syntax objects here also.
<mark_weaver>ugh. I hate to say it, but I wouldn't touch this code with a ten foot pole.
<stis>yep, I did try to speed it up. Not needed if one don't want to.
<stis>mark_weaver: I wanted to explore, not to sell it!
<mark_weaver>in order to support sandboxing, we're planning to change the representation of syntax objects in master, which will break this code.
<mark_weaver>stis: okay, well, I'm glad you're having fun :)
<stis>np. I can fix that later. i would just want to see what logic is needed e.g. the thin stx
<stis>:) fun, yes. But with good sugestions and people with better ideas the semantics can be there and speedy as well
<stis>I did a creative thing with the idententation issue btw. (Painting arrows in emacs)
<stis>I would actually nuke the wset logic at macro expansion time and keep it dynamic as you say.
<stis>I would also see if I can find library codes that take out the needed info from the syntax object
<stis>So it can become better, and not soar yourt eye's as much as it does know :-)
<mark_weaver>stis: what's the purpose of 'ran' anyway? why not just use the normal 'gensym' ?
<stis>ah you found the insane part ;-)
<stis>I will nuke that of the fface of the earth as you say!
<mark_weaver>what is 'thin-stx' trying to do?
<mark_weaver>(the bad indentation makes it too difficult to read)
<stis>it will produce a key from a stx object so that
<stis>1) keywords are as they are
<stis>2) if the stx refers to a local variable then a proper version of the stx should be rreturned to identify it
<stis>3) if an unbounded syntax identifier then use (list sym dir) as a key
<stis>4) if its already bound in a module use the corresponding variable
<stis>as a key
<stis>That's the tought
<mark_weaver>so, if a variable is not bound when you do the 'put', and then is bound when you do the 'get', the lookup doesn't work properly?
<stis>I think that here is where I need good help, because it is tricky. It might be what you want or it might not.
<stis>It's all tied down to guiles evaluation model, and this code should probably belong to the innards of guile in stead of a library
<stis>I did some testing and the code I produced seamed to work quite ok in the few tests I did
<stis>So it's practicall tuned code, hence why it's sop awful, the reason is of cause that my knowledge of how guile should evaluate thinkgs is not that good. or good enough
<stis>So I could not base it on theory.
<stis>if a variable is not bound the symbol referes to something else e.g. a variable in a certain namespace .
<stis>if bound the symbol referes to the bound variable thats the association e.g. focusing on the binding var of a symbol in stead of the symbol itself
<mark_weaver>I'm sorry, I need to go afk for a while.
<stis>cool, anyway thanks for your time.
<mark_weaver>np :)
<stis>:)
<stis>M-x untabify, that will fix the indentation ;-)