Re: [racket-users] Scribble: line comment swallows paragraph break

2015-09-18 Thread Eli Barzilay
On Thu, Sep 17, 2015 at 2:29 PM, Ben Lerner  wrote:
> Yes, in that case.  I meant more the following:
>
> #lang at-exp racket
> '@stuff{
> Hello@; John
>
>   World
> }
>
> which currently produces '(stuff "Hello" "\n" "  " "World").

This sounds like it could be a more surprising behavior than just
swallowing a single newline.  But there's really no right or wrong --
note that this kind of behavior would have made it go even farther than
what the OP wanted...

-- 
((x=>x(x))(x=>x(x)))   Eli Barzilay:
http://barzilay.org/   Maze is Life!

-- 
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.


Re: [racket-users] Scribble: line comment swallows paragraph break

2015-09-18 Thread Eli Barzilay
On Thu, Sep 17, 2015 at 11:30 AM, Matthew Flatt  wrote:
>
> I imagine that Eli adopted that feature of @-expressions from TeX.

Yes -- and it's also similar to a few other comment behaviors, like m4's
`dnl`.  But it sounds like it would be good to qualify the "similar to
% in tex" comment in the docs given the weird thing it does with
paragraph breaks...

-- 
((x=>x(x))(x=>x(x)))   Eli Barzilay:
http://barzilay.org/   Maze is Life!

-- 
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.


Re: [racket-users] Scribble: line comment swallows paragraph break

2015-09-17 Thread Ben Lerner
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 

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  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.


Re: [racket-users] Scribble: line comment swallows paragraph break

2015-09-17 Thread Matthew Flatt
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  
> 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  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.


Re: [racket-users] Scribble: line comment swallows paragraph break

2015-09-17 Thread Alexander D. Knauth
I forgot to include the list:

> On Sep 17, 2015, at 10:57 AM, Alexander D. Knauth  
> 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  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.


Re: [racket-users] Scribble: line comment swallows paragraph break

2015-09-17 Thread Matthew Flatt
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.


Re: [racket-users] Scribble: line comment swallows paragraph break

2015-09-17 Thread Ben Lerner

  
  
Yes, in that case.  I meant more the following:

#lang at-exp racket
'@stuff{
Hello@; John

  World
}

which currently produces '(stuff "Hello" "\n" "  " "World").

On 9/17/2015 2:28 PM, Matthew Butterick
  wrote:


  
> 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.)


Doesn't it already?



  #lang at-exp racket
  '@stuff{
  Hello@; John
            World
  }
  
  
  '(stuff "HelloWorld")
  
  
  
  See also [1]:  "all text from the @; to the end of the
line and all following spaces (or tabs) are part of the
comment (similar to % comments in TeX)."
  
  
  [1] http://pkg-build.racket-lang.org/doc/scribble/reader.html





  
  
On Thu, Sep 17, 2015 at 8:40 AM, Ben
  Lerner 
  wrote:
  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
  

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 
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

[racket-users] Scribble: line comment swallows paragraph break

2015-09-16 Thread Benjamin Greenman
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.