Suggestions to triple quoted strings proposal

zwetan zwetan at gmail.com
Wed Dec 13 02:35:57 PST 2006


Hello all,
here my two cents from a user point of view

- """, why use triple we don't even have double ?
  I would prefer some before-quote-parameter
  as in C# using @"some text here"
  (anyother parameter than @ is fine)

- I like TQS because it allow to write multiline
  without juggling with string concatenation to keep it readable

  """
  hello world
  here another line
  and another line
  """

  is much more readable in source than
  "hello world\nhere another line\nand another line"
   or
   somevar   = "hello world\n"
   somevar += "here another line\n"
   somevar += "and another line"

  so imho the goal of using """ is to be able to write readable
multiline of text
  IN the source code

  but as people indent their code

          """
      ....hello world
      ....here another line
      ....and another line
          """
      (the dots being spaces)

     I would find usefull to have an option (even if it's not pythonesque)
     that strip the 4 spaces on the left automatically
     so if I my lines are aligned they stay readable
     (maybe I'm not super clear here)

    my ideal notation would be something like this

          @-4"
      ....hello world
      ....here another line
      ....and another line
          "

    @ -> we are in multiline
    -4 strip four spaces on the left
    (+4 or 4 could be used to add four spaces on the left)

    resulting in this
    "hello world\nhere another line\nand another line"

- one last option I would like to see also is to be able
  to define the line separator sequence
  "\n" could be the default
  but being able to define "\r", "\r\n" could be helpfull too

OR

Keep the TQS as simple as possible,
no special string rules to remember, all is verbatim

but add a "prettyPrinting" method to the String class
in order to strip spaces/whitespaces at the start of lines AND
replacing the line separator at end of lines

as the String class is final, to have such method native
would be inho more efficient

zwetan



More information about the Es4-discuss mailing list