IRC channel logs

2020-01-11.log

back to list of logs

<NieDzejkob>well, unspecified is implementation defined, it can evaluate to whatever it wants to
<oriansj>and (while '() (display "wrong\n"))
<oriansj>should nil be considered true?
<oriansj>Should (while (display "wrong\n")) run even though it has nothing inside of the expression?
<NieDzejkob>'() is true, see r7rs-small section 6.3 "Of all the Scheme values, only#f counts as false in condi-tional expressions [...] Unlike some other dialects of Lisp, Scheme distinguishes #f and the empty list from each other and from the symbol nil"
<oriansj>hmmmm ok now about guile diverging from the spec in regards to quasiquote
<NieDzejkob>a loop with only the condition also makes sense as the expression can have side effects
<NieDzejkob>re quasiquote: see section 1.3.2: "If such wording does not appear in the discussion of an er-ror, then implementations are not required to detect orreport the error [...] Alternatively, implementations may pro-vide non-portable extensions."
<oriansj>(guess I need to fix my while loop form)
<NieDzejkob>the wording used is "then it is an error if the following expression does notevaluate to a list", so this applies
<oriansj>(1 2 3 . 4) is not a list per the spec
<NieDzejkob>ok, so?
<oriansj>NieDzejkob: my concern with quasiquote is that in guile `(foo bar ,@(+ 4 5)) does not produce a list; which is why I am curious what the correct decision should be (hence the asking of janneke on his opinion)
<oriansj>This is the block of C code which I am trying to decide what to do with: https://paste.debian.net/1125549/
<oriansj>essentially I know how to do it both ways, but I don't know which behavior is more likely to occur in MesCC and guix; thus my desire for insight in which code path to enable or if I should wait until we hit a hard to solve bug only to trace it to this little block of code.
<oriansj>right now I have it error out hard, so it'll be easy to trace the reason and fix but the other way doesn't have a big hard error but makes a subtle change in behavior of the downstream functions which get such output
<oriansj>minus the fact that my ascii art kinda sucks, a new patch of comments and details are up
<oriansj>feel free to find errors or points where my hands didn't keep up with me and letters or words are missing or clarity needs work. (Ideally one should be able to open up mes_eval.c and know exactly how mes-m2 evaluates s-expressions quickly)
<oriansj>Mostly today has been a day of cleaning and reorganization because mes-m2 was just a little bit messy
<oriansj>ok, I think that is enough cleanup of mes_eval.c for tonight; janneke please take a minute to look at it. I need another set of eyes to see what I could do to make it even more obvious how it works and why.
<oriansj>Tomorrow, I'll start simplifying mes_macro.c (shutter)
<janneke>oriansj: i will have a look later today; although about the quasiquote question i may have to defer to #guile
<janneke>i need some more time to re-read your quasiquote question, will do later
<oriansj>janneke: understandably
***Server sets mode: +cnt
<dddddd>hi
<oriansj>morning dddddd
<janneke>oriansj: i do not understand why: `(foo bar ,@(+ 4 5)) has to do with unquote; it's unquote-splicing that is used in a weird way
<janneke>also, i don't understand why you say it does not produce a list?
<janneke>i see that the cdr is not null, but it's still a list?
<janneke>i don't like this code; i would prefer to write: `(foo bar . ,(+ 4 5))
<janneke>but i don't see the difference, really; so what guile does makes sense
<janneke>i am not sure what r7rs says and what that would be different
<janneke>but...this is just my uninformed opinion, possibly take this to #guile
<oriansj>ok
<NieDzejkob>"A list can be defined recursively as either the empty list or a pair whose cdr is a list.", so this is not a proper list
<NieDzejkob>(list? `(foo bar ,@(+ 4 5))) -> #f
<NieDzejkob>oh, more straightforward: "A chain of pairs not ending in the empty list is called animproper list. Note that an improper list is not a list."
<janneke>NieDzejkob: yes, it's not a proper list
<janneke>ah, okay
*janneke still prefers to call it: an improper list rather than "not a list"
<janneke>#f is also "not a list"
<NieDzejkob>I think that this behavior is an accident, since `(foo bar ,@9 baz) signals an error in append
<NieDzejkob>hmm, this might be a bug, actually
<janneke>yeah, i'm really undecided -- i think using this `feature' is ugly
<janneke>but it could very well be that i am missing some perspective
<NieDzejkob>I'm gonna submit a patch to guile that makes this error, we'll see what they say
<oriansj>sounds like a great way to solve this question, good job NieDzejkob
<oriansj>So we will stick with current mes-m2 behavior for quasiquote and when guile responds, we will have our decision made for us and I can quickly change it to the other form if needed.
<NieDzejkob>hmm, actually, now that I think about it, this may have some non-trivial performance implications
<NieDzejkob>like, should improper lists passed to ,@ get detected too?
<NieDzejkob>Racket does it nicely in that it saves in the cons pair whether it is a proper list
<NieDzejkob>which makes (list? _) an O(1) operation
<NieDzejkob>OTOH, just checking for pair? would catch most mistakes
<oriansj>which is what mes-m2 does
***ng0_ is now known as ng0
<NieDzejkob>okay, I'm not gonna submit a patch to guile for this because I apparently don't know enough about the internals of guile