I'm in favour of C++11 syntax. On Monday, September 23, 2013, Steven Ashley wrote:
> Oh right, that's fair enough. I think the indentation/escaping issues can > be fixed however the new line issues you mentioned will still exist for > strings split over multiple lines using this syntax. > > Good luck! > > Steven > > On Monday, September 23, 2013, Kevin Ballard wrote: > > Heredocs are primarily intended for multiline strings. Raw strings are > intended for strings that have no escapes. Raw strings typically allow > newlines, but that is not their primary purpose (and in Rust, regular > strings allow newlines anyway). Trying to use a heredoc syntax for raw > strings is just a headache (because of indentation, and dealing with the > first and/or trailing newline in the heredoc). > > -Kevin > > On Sep 22, 2013, at 11:52 AM, Artem Egorkine <art...@gmail.com> wrote: > > I must be missing something about ruby heredocs, but the indentation had > always been a painful question about them ( > http://stackoverflow.com/questions/3772864/how-do-i-remove-leading-whitespace-chars-from-ruby-heredoc). > Another thing, of course, it's that they are by no means raw (which of > course doesn't stop rust from adopting their syntax for raw strings. I > would just say that it would be nice to pick such syntax for raw strings > that allows for both single line raw strings and multi-line raw strings to > be represented easily. > On Sep 22, 2013 1:00 PM, "Steven Ashley" <ste...@ashley.net.nz> wrote: > > Hi everyone, > > Have we considered syntax similar to Ruby style heredocs? I particularly > like the light looking syntax. > > - The indentation of the block is determined by the indentation of the eos > marker. Keeping code flow natural. > > <<eos > Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do > eiusmod tempor > incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, > quis nostrud > eos > > - Brackets in the eos marker are flipped to allow <<[[[raw]]] > > - eoseos causes a literal eos to be inserted. For example <<"a ""raw"" > string" > > My main concern is that << might be a common operator. Perhaps <<< would > be ok? > > Thoughts? > On 21/09/2013 4:28 AM, "Alex Crichton" <a...@crichton.co> wrote: > > > Of the 3, Lua's is probably the best, although it's a bit esoteric (with > > using [[ and nary a quote in sight). > > I think an important thing to keep in mind is that the main reason > behind creating a new form of literal is for things like: > > * Escapes in format! strings > * Possible regular expression syntax (this also may be a syntax extension) > * Type literal windows paths (escaping \ is hard) > * Otherwise long literals which may contain quotes (like html text) > > With those in mind, although Lua's syntax is sufficient, is it nice to > use? If the first thing I saw as an introduction to Rust was: > > fn main() { > println!([[Hello, {}!]], "world"); > } > > I would be a little confused. Now the [[/]] aren't really necessary in > this case, but I'm personally unsure of how usable [[/]] would be > throughout the language. Raw literals in languages like C++ and Lua I > think aren't intended to be used that often. Instead they should be > used only when necessary, and you frequently don't see them in code. > For rust, the use cases which are the cause of this discussion are > actually fairly common, and I'm not sure that we'd want to see [[/]] > all over the place, although of course that's just my opinion :) > > Skimming back, I haven't seen a suggestion of the backtick character > as a delimiter. Go takes this approach, and I don't believe that in Go > you can have a backtick anywhere in a backtick literal, and otherwise > what you see is what you get. It's at least something to consider, > though. > _______________________________________________ > Rust-dev mailing list > Rust-dev@mozilla.org > https://mail.mozilla.org/listinfo/rust-dev > > > _______________________________________________ > Rust-dev mailing list > Rust-dev@mozilla.org > https://mail.mozilla.org/listinfo/rust-dev > > > < >
_______________________________________________ Rust-dev mailing list Rust-dev@mozilla.org https://mail.mozilla.org/listinfo/rust-dev