If a comment can swallow everything up to a single newline, could it swallow everything up to the first non-whitespace character after the current line? (This is what TeX's % does.) So you wouldn't have to change scribble/decode at all, just the @-reader. Effectively, the only added constraint for authors is that a paragraph of text cannot end with a line comment, which seems like a potentially acceptable tradeoff for consistent behavior between TeX and other output formats.

On 9/17/2015 11:30 AM, Matthew Flatt wrote:
Having a line comment swallow a newline is helpful when you want to
break up something in the source without a break in the output, as in

Hello@;
World

=>

"HelloWorld"

I imagine that Eli adopted that feature of @-expressions from TeX.

At Thu, 17 Sep 2015 10:59:51 -0400, "Alexander D. Knauth" wrote:
I forgot to include the list:

On Sep 17, 2015, at 10:57 AM, Alexander D. Knauth <alexan...@knauth.org>
wrote:
Is there any reason why
#lang at-exp racket
'@stuff{
Hello @; John

World
}
Shouldn't produce
'(stuff "Hello " "\n" "\n" "World")
Instead of
'(stuff "Hello " "\n" "World")
?
In other words, should the newline after the line comment still count as a
newline?
On Sep 17, 2015, at 10:49 AM, Matthew Flatt <mfl...@cs.utah.edu> wrote:

Scribble can't be changed to match LaTeX without changing @-expression
reader at a fairly fundamental way, and I'm skeptical of the change.

Scribble's input is handled in three steps: @-expression parsing to
produce a syntax object (i.e., enriched S-expression), Racket expansion
and evaluation of the resulting syntax objects to produce values, and
(interleaved with the second step) a `scribble/decode` layer that is
used by some contexts (including the module body for `scribble/manual`)
to find paragraph based on the values produces by the second step. A
paragraph is determined at that last step as a pair of newlines
separated only by whitespace content.

LaTeX handles input in one big character-oriented sweep. In the default
mode, it effectively sees a source line that contains only white space
(before comment or other handling) and converts it into a `\par`. So,
it's detecting paragraphs at a much earlier point than Scribble ----
unless you're in something like a `verbatim` environment, where that
character-level handling is changed and blank lines are handled in a
different way. Of course, the character-level nature of macros is one
of the things that makes TeX macros so powerful, but also one of the
things that make them non-composable.

For Scribble to define paragraph breaks in terms of blank source lines
(i.e., blank before handling comments or other expansions), the notion
of paragraph breaks would have to be built into @-expression layer.
Since the notion of paragraph breaks doesn't apply to some uses of
@-expression notation, paragraph breaks would have to reflected in some
different way than, say, inserting `(par)` into the stream as in LaTeX.
A syntax property could be attached to a newline to indicate that its
source line is blank, but those are fragile (e.g., not preserved in
bytecode), and they only work on syntax-object representations of
S-expressions. Whatever a better solution might be, I think an even
better "solution" is to not to try to solve this problem and keep the
@-expression model simpler.

At Wed, 16 Sep 2015 18:42:22 -0400, Benjamin Greenman wrote:
Scribble and LaTeX disagree on these documents. Should Scribble be changed
to match LaTeX?

Scribble:
#lang scribble/manual

Hello @; John

World

Output is:
"Hello World"

;; ---

LaTeX
\documentclass{article}
\begin{document}
Hello % John

World
\end{document}

Output is:
"Hello
World"

--
You received this message because you are subscribed to the Google Groups
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Racket 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to