Ruby Continue String on Next Line
line continuation
Author | Message |
---|---|
line continuation can a ruby statement break into multiple lines? thx, _________________________________________________________________________ | |
Wed, 16 Jul 2003 16:43:34 GMT | |
line continuation Quote: > can a ruby statement break into multiple lines? Yes, if you have the Ruby-book see page 201. a = 2 + a = 2 \ here you need the \ at the end of the line. -- | |
Wed, 16 Jul 2003 18:10:21 GMT | |
line continuation Quote: >A statement break into mutliple lines if it is not complete, >a = 2 + >a = 2 \ >here you need the \ at the end of the line. While it's nice that you can do this, can someone explain why it is I assume it makes the parsing a little easier, but I do find it a pain | |
Thu, 17 Jul 2003 08:02:47 GMT | |
line continuation Quote: > While it's nice that you can do this, can someone explain why it is Because C++ and Java statements are terminated with a ; . -spc | |
Thu, 17 Jul 2003 08:04:17 GMT | |
line continuation Quote: > While it's nice that you can do this, can someone explain why it is Very simple - C++ and Java make you end every statement with a semicolon. | |
Thu, 17 Jul 2003 08:17:06 GMT | |
line continuation Quote: ----- Original Message ----- Sent: Saturday, January 27, 2001 4:10 PM > >A statement break into mutliple lines if it is not complete, > >a = 2 + > >a = 2 \ > >here you need the \ at the end of the line. > While it's nice that you can do this, can someone explain why it is > I assume it makes the parsing a little easier, but I do find it a pain Well, for one thing, Ruby has no required statement terminator (semicolon). Thus a = 2 is actually two statements, isn't it? Hal Fulton | |
Thu, 17 Jul 2003 08:16:32 GMT | |
line continuation Quote: > >A statement break into mutliple lines if it is not complete, > >a = 2 + > >a = 2 \ > >here you need the \ at the end of the line. > While it's nice that you can do this, can someone explain why it is Because the code layout is, in many cases, the *only* information Think of it this way: if we wrote sentences without periods (and David -- Web: http://pirate.shu.edu/~blackdav | |
Thu, 17 Jul 2003 08:29:20 GMT | |
line continuation Quote: > >A statement break into mutliple lines if it is not complete, > >a = 2 + > >a = 2 \ > >here you need the \ at the end of the line. > While it's nice that you can do this, can someone explain why it is I guess this was already answered in other mails. Quote: > I assume it makes the parsing a little easier, but I do find it a pain I wrote to relief your pre-pains a bit. I agree it's a pain in the ass to get syntax error because of missed Anyway, this bug doesn't bite too often by accident. If you adopt Usually when a statement grows over line there's something in your - Aleksi | |
Thu, 17 Jul 2003 08:35:57 GMT | |
line continuation Quote: >> While it's nice that you can do this, can someone explain why it is >Very simple - C++ and Java make you end every statement with a semicolon. I think the answer is more complex than that and has to do with the | |
Thu, 17 Jul 2003 10:26:51 GMT | |
line continuation Quote: > Anyway, this bug doesn't bite too often by accident. If you adopt > Usually when a statement grows over line there's something in your I disagree with that, since it is in the style of functional programming to def CDDB.from_sql(res) You'll probably see even longer chains than that all the time, and in those -- | |
Thu, 17 Jul 2003 13:04:46 GMT | |
line continuation Quote: > > Anyway, this bug doesn't bite too often by accident. If you adopt > > Usually when a statement grows over line there's something in your > I disagree with that, since it is in the style of functional programming to > def CDDB.from_sql(res) > You'll probably see even longer chains than that all the time, and in those While I agree with you that there's a certain tendency to produce I like call chaining, even to the point I really like to get away with Simultaneously when you reorganize the above code there's an effect def CDDB.from_sql(res) I'm not claiming this example is in some way the ultimate, most Still I'd like to exploit the possible rule of "unsub every second Anyway, I guess you get my point. I think it's quite rare event that There are some simple cases where the change is easy to do, like Do we still disagree ?) - Aleksi | |
Thu, 17 Jul 2003 19:15:11 GMT | |
line continuation Hi -- Quote: > Anyway, I guess you get my point. I think it's quite rare event that I'm just curious -- do you make that distinction automatically (single David --=20 Web: http://pirate.shu.edu/~blackdav | |
Thu, 17 Jul 2003 20:04:16 GMT | |
line continuation Quote: > I'm just curious -- do you make that distinction automatically (single Not speaking for Aleksi, but it's a convention that I like. It seems for cd in collection to me looks cleaner than for cd in collection There's another style I;ve seen her which I'm still thinking a.doit { It certainly looks nice, but I can't quite convince myself there's a Dave | |
Thu, 17 Jul 2003 21:38:01 GMT | |
line continuation Quote: > > I'm just curious -- do you make that distinction automatically (single > Not speaking for Aleksi, but it's a convention that I like. It seems > for cd in collection > to me looks cleaner than > for cd in collection I agree -- though I'm not to be trusted, as I also tend to like the Quote: > There's another style I;ve seen her which I'm still thinking > a.doit { > It certainly looks nice, but I can't quite convince myself there's a I originally liked doing that, especially with do/end: things.each do An argument could be made that breaking the line between the "do" I've actually trained myself to put the |t| right by the "do" because David -- Web: http://pirate.shu.edu/~blackdav | |
Thu, 17 Jul 2003 21:50:21 GMT | |
line continuation Quote: > > > Usually when a statement grows over line there's something in your > > I disagree with that, since it is in the style of functional programming to > > def CDDB.from_sql(res) > > You'll probably see even longer chains than that all the time, and in those > While I agree with you that there's a certain tendency to produce You think so? My eyes, when following it, are drawn to the periods and the Quote: > I like call chaining, even to the point I really like to get away with Example (evil one, maybe :) from the same file: subber = lambda {|s| It's not actually chained because I decided to use the bang-methods. Also, I notice that I tend to give ephemeral arguments one-letter names. Quote: > Simultaneously when you reorganize the above code there's an effect > def CDDB.from_sql(res) > I'm not claiming this example is in some way the ultimate, most I'm one of those people that believe that if you're only using something I agree that using listed_numbers probably does make things that much easier CDDBStruct.new(unsubber.call(res[0]), Uniformity makes it a bit more pleasing, but you're right that it can't be Quote: > Still I'd like to exploit the possible rule of "unsub every second I don't think that's a very good rule, because it's really just... CDDBStruct = Struct.new('CDDB', Stored in SQL, it's: ... freedb (discid text[], dtitle text, ttitle text[], The range 1..-2 will probably be seen an awful lot as the most common idiom Quote: > Anyway, I guess you get my point. I think it's quite rare event that > There are some simple cases where the change is easy to do, like > Do we still disagree ?) It's a matter of style :) I feel you raise a lot of good points, but I find P.S.: I just noticed that using Ruby for this kind of stuff rather than C, -- | |
Thu, 17 Jul 2003 23:13:14 GMT | |
Page 1 of 2 | [ 18 post ] | Go to page: [1] [2] |
Powered by phpBB® Forum Software
Source: http://computer-programming-forum.com/39-ruby/56fcc8e820612523.htm
0 Response to "Ruby Continue String on Next Line"
Post a Comment