On Sep 19, 2013, at 2:13 PM, Masklinn <maskl...@masklinn.net> wrote:

> On 2013-09-19, at 22:36 , Kevin Ballard wrote:
>> 
>> I welcome any comments, criticisms, or suggestions.
> 
> * C# also has rawstrings, which were not looked at. C#'s rawstrings
>  disable escaping entirely but add a new one: doubling quotes will insert
>  a single quote in the resulting string (similar to quote-escaping in
>  SQL or Smalltalk).

I've never touched C#. Your description sounds like the "custom syntax" I 
described. I figured there were existing languages that did this, but none came 
to mind (I should have known SQL did it though).

> * The docstring comment is incorrect, a docstring is a string in the
>  first position of a module, a class statement or a function statement.
>  A single-quoted string at these positions will yield a docstring.
> 
>  The triple-quoting is a string syntax embedding newlines (single-quoted
>  strings can not contain literal newlines in Python, only escaped ones).
>  Obviously, triple-quoted python string can be raw.

Yes I know, but in my (rather limited) experience with Python, triple-quoted 
strings are typically used for docstrings. It was just an example anyway.

> * The quote-escaping oddness is less of an issue in Python as you can
>  also use single-quotes for delimiting, or use triple-quoted strings
>  (if you need to embed both single and double quotes in rawstrings).

If I need to embed both ''' and """ in a string, I'm out of luck. For example, 
I cannot represent the following:

    Triple-quoted strings in Python use the delimiters ''' and """.

> * Perl's quotes and quote-like operators would certainly deserve mention.

I'm not a Perl programmer, but IIRC they look like `q{string}`, right? I don't 
think this is suitable for Rust because how would you lex `do q{foo()}`? Is 
this the invalid construct `do some-string` or is it calling a function named q 
with a closure?

> Also,
> 
>> windows file paths
> 
> windows paths can also use forward slashes so that's not a very
> interesting justification.

Not always. UNC paths must start with \\ (in my testing, //foo/bar/baz is not 
interpreted as a UNC path by the Windows File Explorer, but \\foo/bar/baz is). 
There's also paths that start with the verbatim prefix \\?\, which disables 
interpretation of forward-slashes (among other things).

As I am actively engaged in writing a replacement for the path module, and am 
currently expanding the test suite for Windows paths, raw strings would be 
extremely useful to me.

-Kevin
_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to