IRC channel logs


back to list of logs

<daviid>sneek: later tell rekado => 504 Gateway Time-out
<parnikkapore>How do you test a macro? I've tried searching around but found no answers
<janneke>parnikkapore: by using it?
<parnikkapore>well, that's certainly an answer haha
<parnikkapore>I'm talking about srfi-64(?) unit tests
<janneke>same answer, iow, i do not understand your question
<parnikkapore>ah, let me rephrase
<parnikkapore>how do you write a unit test for a macro? (ideally an srfi-64 unit test)
<parnikkapore>if you just run it, are there some things I need to be aware of to make sure it's effective?
<janneke>i wouldn't know
<parnikkapore>yeah, "run it and inspect the results" seems to be the pattern in Guix too
<parnikkapore>thank you regardless!
<janneke>if you'd write a new flavor of "if" called "iff", you'd probably do something like:
<janneke> test-assert "iff true true" (iff #t #t #f))
<janneke>parnikkapore: yw, good luck!
<dsmith>One way test a macro to quote the expansion and inspect the result. Invasive. Prob best used during development.
<rlb>There's no trick to (internally) carry a raw/opaque scm_gc_malloc_pointerless() pointer in the SCM_CAR of a list is there? More specifically if the list is never exposed to any other scheme code -- say it's just being used as temporary storage on the C side. Of course you could just SCM_PACK_POINTER it, but if I'm reading them right, the docs warn away from that.
<rlb>I ask because there are a few cases where that'd be nice wrt code simplicity when building up utf-8 fragments to then join into the final string. We can of course just use bytevectors, but we have no need for the extra overhead (in this case the fragments are 256-byte, so that'll be at least 24-bytes wasted), and perhaps more notably that prevents it being trivial (code-wise) to optimize the common case on the stack.
<rlb>(I have a suspicion that atm, just cheating would work, but don't want to do that of course unless we're promising it will.)
<rlb>nvm, hybrid approach worked out OK (a bit chattier, but OK)