r31082 -[S32/Str] rethinking of tab characters

2010-06-03 Thread pugs-commits
Author: masak
Date: 2010-06-03 15:52:01 +0200 (Thu, 03 Jun 2010)
New Revision: 31082

Modified:
   docs/Perl6/Spec/S32-setting-library/Str.pod
Log:
[S32/Str] rethinking of tab characters

Also added a Str.indent(*) use case.

Modified: docs/Perl6/Spec/S32-setting-library/Str.pod
===
--- docs/Perl6/Spec/S32-setting-library/Str.pod 2010-06-03 13:35:39 UTC (rev 
31081)
+++ docs/Perl6/Spec/S32-setting-library/Str.pod 2010-06-03 13:52:01 UTC (rev 
31082)
@@ -594,9 +594,18 @@
 If C$steps is negative, removes that many spaces instead. Should any line
 contain too few leading spaces, only those are removed and a warning is issued.
 
-Only spaces are considered indentation; tabs or other Unicode whitespace
-characters are not considered.
+If C$steps is C*, removes exactly as many spaces as are needed to make at
+least one line have zero indentation.
 
+When removing indentation, the method will assume hard tabs to be
+C ($?TABSTOP // 8)  spaces, and will treat other horizontal whitespace
+characters as synonymous to spaces. Characters not participating in the
+re-indenting will be left untouched, and those added in an indent call will
+be either (1) consistent with subsequent leading whitespace already on the
+line, if these are all the same, or (2) spaces. During an unindent, the
+trailing tab character in a chain of leading tab characters may explode
+into a number of space characters.
+
 =back
 
 =head1 Additions



Re: r31082 -[S32/Str] rethinking of tab characters

2010-06-03 Thread Stefan O'Rear
On Thu, Jun 03, 2010 at 03:52:02PM +0200, pugs-comm...@feather.perl6.nl wrote:
 Author: masak
 Date: 2010-06-03 15:52:01 +0200 (Thu, 03 Jun 2010)
 New Revision: 31082
 
 Modified:
docs/Perl6/Spec/S32-setting-library/Str.pod
 Log:
 [S32/Str] rethinking of tab characters
 
 Also added a Str.indent(*) use case.

I request that:

1. Blank lines should not be interpreted as having 0 indentation.  Instead,
   lines consisting entirely of horizontal whitespace should be ignored in
   indent(*) considerations, and can be unindented by any amount.  Unindenting
   a truly blank line has no effect.

2. Indenting a blank line results in a blank line, not a line with only
   whitespace.

3. A variant of indent be provided which does not treat the first character
   specially, perhaps named .indent(4 :hang) or .hang.

-sorear


signature.asc
Description: Digital signature


Re: r31082 -[S32/Str] rethinking of tab characters

2010-06-03 Thread Carl Mäsak
sorear ():
 I request that:

 1. Blank lines should not be interpreted as having 0 indentation.  Instead,
   lines consisting entirely of horizontal whitespace should be ignored in
   indent(*) considerations, and can be unindented by any amount.  Unindenting
   a truly blank line has no effect.

Fair enough.

 2. Indenting a blank line results in a blank line, not a line with only
   whitespace.

What about indenting a line with only whitespace?

I think I can see use cases both for special-casing and for not
special-casing indenting empty lines. Perhaps that indicates that
this, too, should be a flag. :indent-empty-lines or something?

 3. A variant of indent be provided which does not treat the first character
   specially, perhaps named .indent(4 :hang) or .hang.

I fail to understand what 'does not treat the first character
specially' means here. Do you have an example?

// Carl


Re: r31082 -[S32/Str] rethinking of tab characters

2010-06-03 Thread Stefan O'Rear
On Thu, Jun 03, 2010 at 07:00:17PM +0200, Carl Mäsak wrote:
 sorear ():
  2. Indenting a blank line results in a blank line, not a line with only
    whitespace.
 
 What about indenting a line with only whitespace?

Implementor's choice; it won't come up in the viv port.

 I think I can see use cases both for special-casing and for not
 special-casing indenting empty lines. Perhaps that indicates that
 this, too, should be a flag. :indent-empty-lines or something?

Agreeable.

  3. A variant of indent be provided which does not treat the first character
    specially, perhaps named .indent(4 :hang) or .hang.
 
 I fail to understand what 'does not treat the first character
 specially' means here. Do you have an example?

is(a\nb.indent(1),  a\n b, indent puts space on the first line);
is(a\nb.hang(1), a\n b, hang does not put space on the first line);

hang is useful in formatting applications involving left-to-right composition,
such as foo:  ~ $text.hang(5)

-sorear


signature.asc
Description: Digital signature