Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Switch to doing newline translation on Win32.
Now, \n always means \x0A by default (the newline pragma currently is
still available, pending a decision from TimToady++ on its future). We
translate \r\n on file/pipe input to \n, and \n to \r\n on output. We
don't perform any such translation on sockets, nor on explict .encode
and .decode calls (providing an escape hatch). \r\n remains a single
grapheme, though you're now much less likely to run in to one. This
brings us in line with how the problem has commonly been tackled in
other languages; logical \n turned out not to work out so well in real
life, even if avoiding the cost of boundary translation was nice. Note
that we translate at grapheme, not codepoint, level, so a \r\n will
never accidentally become \r\r\n (as can happen in some translation
layers).
  • Loading branch information
jnthn committed Dec 16, 2015
1 parent f303efc commit 680da78
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
10 changes: 1 addition & 9 deletions src/core/core_prologue.pm
Expand Up @@ -24,14 +24,6 @@ my constant Empty = nqp::p6bindattrinvres(nqp::create(Slip),
List, '$!reified', nqp::create(IterationBuffer));

# The value for \n.
my constant $?NL =
#?if jvm
nqp::iseq_s(nqp::atkey(nqp::jvmgetproperties(), 'os.name'), 'MSWin32')
#?endif
#?if moar
nqp::iseq_s(nqp::atkey(nqp::backendconfig(), 'osname'), 'MSWin32')
#?endif
?? "\x0D\x0A"
!! "\x0A";
my constant $?NL = "\x0A";

# vim: ft=perl6 expandtab sw=4
2 changes: 1 addition & 1 deletion tools/build/NQP_REVISION
@@ -1 +1 @@
2015.11-58-gb13205b
2015.11-61-gf73fb45

0 comments on commit 680da78

Please sign in to comment.