To me, that is not an idiom; this is an idiom:
foo(“This is a really long string. in fact it is so long
that it requires two lines…”)
To me, that makes much more sense.
David Douthitt
CUNA & Affiliates
UNIX Systems Administrator
ddouthitt@cuna.coop
(608) 231-4922
pbrannan@atdesk.com 7/23/02 3:09PM >>>
- compile time string concatenation, “hello” “world” => “helloworld”
I know that some other popular languages like to do that,
but I think it would be better to leave it as two arguments.
After all, someone wrote those two literals separately on purpose.
The following is a common idiom:
foo("this is a really long string. in fact, it is so long "
“that I have to wrap onto multiple lines.”)
Paul
···
On Wed, Jul 24, 2002 at 12:46:37AM +0900, Mike Hall wrote:
There is at least one problem with that:
irb(main):001:0> s = “this is a
irb(main):002:0” test"
“this is a test”
irb(main):003:0> s = “this is a \
irb(main):004:0” test"
“this is a \ntest”
The difference here is subtle. The second case has a space after the .
It also has the side-effect of messing up indentation.
Paul
···
On Wed, Jul 24, 2002 at 05:40:29AM +0900, David Douthitt wrote:
To me, that is not an idiom; this is an idiom:
foo(“This is a really long string. in fact it is so long
that it requires two lines…”)
To me, that makes much more sense.
David Douthitt wrote:
To me, that is not an idiom; this is an idiom:
foo(“This is a really long string. in fact it is so long
that it requires two lines…”)
To me, that makes much more sense.
David Douthitt
CUNA & Affiliates
UNIX Systems Administrator
ddouthitt@cuna.coop mailto:ddouthitt@cuna.coop
(608) 231-4922
pbrannan@atdesk.com 7/23/02 3:09PM >>>
- compile time string concatenation, “hello” “world” => “helloworld”
I know that some other popular languages like to do that,
but I think it would be better to leave it as two arguments.
After all, someone wrote those two literals separately on purpose.
The following is a common idiom:
foo("this is a really long string. in fact, it is so long "
“that I have to wrap onto multiple lines.”)
Paul
I find that aligning code via white-space makes it more intelligible.
I don’t really care whether one says:
foo(“this is a really long string. in fact, it is so long
that I have to wrap onto multiple lines.”)
or
foo(“this is a really long string. in fact, it is so long
that I have to wrap onto multiple lines.”)
I dislike the second half of the string starting at the beginning of the
line. And I don’t really care whether one says:
foo(“this is a really long string. in fact, it is so
long \n”
“that I have to wrap onto multiple lines.”)
or
foo(“this is a really long string. in fact, it is so
long \n”
+ " that I have to wrap onto multiple lines.")
They both preserve indentation.
···
On Wed, Jul 24, 2002 at 12:46:37AM +0900, Mike Hall wrote:
–
– Charles Hixson
Gnu software that is free,
The best is yet to be.
Note that this is not legal in Ruby. The + must go at the end of the
first line.
Also note that the original string did not contain a \n.
Paul
···
On Wed, Jul 24, 2002 at 07:19:15AM +0900, Charles Hixson wrote:
foo("this is a really long string. in fact, it is so
long \n"
+ " that I have to wrap onto multiple lines.")