July 28, 2003 Re: String literals | ||||
---|---|---|---|---|
| ||||
Posted in reply to Daniel Yokomiso | "Daniel Yokomiso" <daniel_yokomiso@yahoo.com.br> wrote in message news:bg0q5t$2ieb$1@digitaldaemon.com... | | Hi, | | Couldn't we use a symbol for character literals, like other languages, | like #a or $a for the letter "a"? It would probably be simpler, and we could | keep '' and "" for strings. Also \ would be character literals, instead of | single character strings. | | Best regards, | Daniel Yokomiso. | I was going to vote for $"wysiwyg string", but now this seems like a better idea, IMHO. ————————————————————————— Carlos Santander --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.504 / Virus Database: 302 - Release Date: 2003-07-24 |
July 28, 2003 Re: String literals | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | > `string` > """string""" Instinct tells me that this is a parsing nightmare, no? > r"string" |
July 28, 2003 Re: String literals | ||||
---|---|---|---|---|
| ||||
Posted in reply to Burton Radons | > It's likely to be on every Romantic language's keyboard; you can look at their layouts at (http://www.microsoft.com/globaldev/reference/keyboards.aspx) using Internet Explorer only. But I wouldn't use the symbol; I don't think the problem, even if I agreed that it exists, merits the use of a new symbol. There hasn't been a new symbol in C in thirty years. C++ didn't add any new symbols. This conservatism can get out-of-hand, but unless if there is absolutely no way to do otherwise I don't think there should be new symbols.
That is a good point.
|
July 28, 2003 Re: String literals | ||||
---|---|---|---|---|
| ||||
Posted in reply to Carlos Santander B. | I don't see the point of wysiwyg string. You will need escapes for the quotes anyway, and in order to have escapes you have to have an escape for the escape character. Next thing you know you're back at the "normal" C string. Why do we need two kinds of string again? So people can embed control characters in the string or something? Sean "Carlos Santander B." <carlos8294@msn.com> wrote in message news:bg2469$ta2$1@digitaldaemon.com... > I was going to vote for $"wysiwyg string", but now this seems like a better > idea, IMHO. |
July 28, 2003 Re: String literals | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | >
> Some possibilities are:
> 1) prefixing the " with a letter or a character, as in:
> W"string"
> %"string"
> !"string"
> 2) using a character not used in C, such as:
> `string`
> $string$
> @string@
> #string#
I vote for method 1)
It has the advantage of changing from one to the other
more easily -- as in
"oops - that should be the other kind"
*"string" might work.
Karl Bochert
|
July 28, 2003 Re: String literals | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ilya Minkov | Ilya Minkov wrote: > Walter wrote: > >> In a proportional font, they are nearly indistinguishable. > > > I think Python uses something like triple double quotes for something. > > """This is a docstring or a preformatted string, IIRC.""" Preformatted. foo = """ here the \n's are maintained. """ There are some formatting options as well with them (%s etc) > > -i. > |
July 28, 2003 Re: String literals | ||||
---|---|---|---|---|
| ||||
Posted in reply to Burton Radons | > I like r"string", which is used in a number of languages already.
>
I've finally decided I vote for this one.
|
July 28, 2003 Re: String literals | ||||
---|---|---|---|---|
| ||||
Posted in reply to Carlos Santander B. | I definitely go for something like this, using
single quotes '' and double quotes, with something
else, for single characters. I would hate to see
the syntax get cluttered up just to diferentiate
single characters from strings. The syntax of ''
and "" is simple, clean, and attractive.
Carlos Santander B. wrote:
> "Daniel Yokomiso" <daniel_yokomiso@yahoo.com.br> wrote in message
> news:bg0q5t$2ieb$1@digitaldaemon.com...
> |
> | Hi,
> |
> | Couldn't we use a symbol for character literals, like other languages,
> | like #a or $a for the letter "a"? It would probably be simpler, and we
> could
> | keep '' and "" for strings. Also \ would be character literals, instead of
> | single character strings.
> |
> | Best regards,
> | Daniel Yokomiso.
> |
>
> I was going to vote for $"wysiwyg string", but now this seems like a better
> idea, IMHO.
>
> —————————————————————————
> Carlos Santander
>
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.504 / Virus Database: 302 - Release Date: 2003-07-24
>
>
|
July 28, 2003 Re: String literals | ||||
---|---|---|---|---|
| ||||
Posted in reply to Burton Radons | C# is similar: @"string". Dan "Burton Radons" <loth@users.sourceforge.net> wrote in message news:bfusdh$k5e$1@digitaldaemon.com... > Walter wrote: > > Currently, there are 3 kinds of string literals: > > 'string' : wysiwyg strings > > "string" : escaped strings > > \ : single character strings > > > > There is no character literal syntax; 1 character long strings are implicitly converted to character literals based on context. Unfortunately, > > this leads to ambiguities with no reasonable way out (other than crafting > > arbitrary and confusing rules). > > > > So, I've been thinking of going back to the C way and having ' ' for character literals. That means that wysiwyg strings are left without a lexical syntax. Any ideas for something that would look nice? How about using back quotes ` `, or is that just too hard to distinguish in certain > > fonts? One thing to keep in mind is that wysiwyg strings are not going to be > > used with nearly the same frequency as escaped strings, so the syntax can be > > a bit less convenient for them. > > I like r"string", which is used in a number of languages already. > |
July 28, 2003 Re: String literals | ||||
---|---|---|---|---|
| ||||
Posted in reply to Sean L. Palmer | I don't see the point either, I vote not to include it. Charles "Sean L. Palmer" <palmer.sean@verizon.net> wrote in message news:bg2kii$1fs0$1@digitaldaemon.com... > I don't see the point of wysiwyg string. You will need escapes for the quotes anyway, and in order to have escapes you have to have an escape for the escape character. Next thing you know you're back at the "normal" C string. > > Why do we need two kinds of string again? So people can embed control characters in the string or something? > > Sean > > "Carlos Santander B." <carlos8294@msn.com> wrote in message news:bg2469$ta2$1@digitaldaemon.com... > > I was going to vote for $"wysiwyg string", but now this seems like a > better > > idea, IMHO. > > > |
Copyright © 1999-2021 by the D Language Foundation