<div dir="ltr"><div>Perhaps I'm overlooking some obvious complication. But today, the pattern of how Scribble parses @ ‹cmd› [ ‹datum›* ] { ‹text-body› } is roughly "apply <cmd> to the list formed by concatenating the datum arguments and the text-body arguments". So it seems to me that this pattern could be logically extended to cover any number of datum or text-body blocks.<br>
</div><div><br></div><div>For instance, today, this expression:<div><div><br></div><div><div>@foo[1 2]{3 <br>4}</div></div><div><br></div><div style>expands to:</div><div style><br></div><div style>(foo 1 2 "3" "\n" "4")<br>
</div><div style><br></div><div style>Therefore, this expression:</div><div style><br></div><div style>@foo{3 <br>4}[5 6]<br></div></div></div><div style><br></div><div style>would expand to</div><div style><br></div>
<div style>(foo "3" "\n" "4" 5 6)<br></div><div style><br></div><div style>And this:</div><div style><br></div><div style>@foo[1 2]{3 <br>4}[5 6]{7<br></div><div style>8}</div><div style>
<br></div><div style>To this:</div><div style><br></div><div style>(foo 1 2 "3" "\n" "4" 5 6 "7" "\n" "8")<br></div><div style><br></div><div style>If you needed a text body to become a single argument, you would just do what you do today, which is add another set of braces to produce a sublist. So this:</div>
<div style><br></div><div style>@foo{@{3 <br>4}}[5 6]<br></div><div style><br></div><div style>Would become:</div><div style><br></div><div style>(foo ("3" "\n" "4") 5 6)<br></div><div class="gmail_extra">
<br></div><div class="gmail_extra" style>You could also convert the sublist back into a string with string-join. But again, that's consistent with current behavior, so NBD.</div><div class="gmail_extra" style><br></div>
<div class="gmail_extra"><div><br></div></div><div class="gmail_extra"><br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Jun 9, 2013 at 6:14 PM, Robby Findler <span dir="ltr"><<a href="mailto:robby@eecs.northwestern.edu" target="_blank">robby@eecs.northwestern.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div>But a block of text does not always turn into a single argument, so I'm not sure how to do what you ask.<br>
<br></div>Robby<br></div><div class="gmail_extra"><br><br><div class="gmail_quote"><div><div class="h5">On Sun, Jun 9, 2013 at 7:05 PM, Matthew Butterick <span dir="ltr"><<a href="mailto:mb.list.acct@gmail.com" target="_blank">mb.list.acct@gmail.com</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div><div class="h5"><div dir="ltr">Semantically, "an operation [in Scribble] doesn’t care whether it’s used with [...] or {...}." Therefore, it would be useful if Scribble expressions were not syntactically limited to the form @ ‹cmd› [ ‹datum›* ] { ‹text-body› }, and instead allowed text-mode and racket-mode arguments to be freely & indefinitely sequenced.<div>
<br></div><div>What I've found using Scribble is that many of the functions one writes are, of course, intended to operate on a text argument. So the text-mode argument naturally wants to come first in the function:</div>
<div><br></div><div>@cross-ref{This text}</div><div><br></div><div>Now, suppose I want to add an optional second argument. The natural place for this optional argument would be after the first:</div>
<div><br></div><div>@cross-ref{This text}["where.html"] </div><div><br></div><div>or</div><div><br></div><div>@cross-ref{This text){where.html}<br></div><div><br></div>
<div>But AFAIK, Scribble forbids these patterns. So I might try this:</div><div><br></div><div>@cross-ref["where.html"]{This text}</div><div><br></div><div>But that doesn't work either, because the cross-ref function expects the target text to be in the first position. So either I must forego idiomatic Scribble expressions altogether:</div>
<div><br></div><div>@(cross-ref "This text" "where.html") </div><div><br></div><div>Or use a keyword argument:</div><div><br></div><div>@cross-ref[#:destination "where.html"]{This text}</div>
<div><br></div><div>As a workaround, that's OK. But at this point, Scribble is reaching up into my code and starting to impose design restrictions (namely, keyword arguments) that have ripple effects elsewhere.</div>
</div>
<br></div></div>____________________<br>
Racket Users list:<br>
<a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br></div></div>