July 26, 2003
Make that 3 then. :)

"John Reimer" <jjreimer@telus.net> wrote in message news:bfur97$ieh$1@digitaldaemon.com...
> I like backquotes:
>
> `string`
>
> I don't think it's too confusing.
>


July 26, 2003
The difference to single quotes is hardly noticable if you have a 160dpi display and space is tight. :) Like, my main programming machine is a high-performace handheld notebook with a *really* tiny display. :) You can guess that i don't have sausage-like fingers. :)

The backquote is better left for something, which cannot be easily confused with strings.

Better a sane prefix (like Burton's r -- whatever it means it looks good) or """ """.

-i.

John Reimer wrote:
> I like backquotes:
> 
> `string`
> 
> I don't think it's too confusing.
> 

July 26, 2003
"Matthew Wilson" <matthew@stlsoft.org> wrote in message news:bfv0or$oeh$2@digitaldaemon.com...
> Here's an unpopular thought: why not use @"string" and be consistent with C#? Easier on the brain even if it doffs one's cap to M$

It's aesthetically unpleasing.


July 26, 2003
Walter wrote:
> "Burton Radons" <loth@users.sourceforge.net> wrote in message
> news:bfusdh$k5e$1@digitaldaemon.com...
> 
>>I like r"string", which is used in a number of languages already.
> 
> 
> Which ones?

I can only find Python right now, but I've seen it used in some other languages, prototypes exclusively I think (Xana is one).

I don't think the problem really exists.  There's no reason to have single-character variants of functions like string.find; if the benefits to such a search is significant, then the cost of matching a check and running a special loop is insignificant.  I have never had the problem come up outside of calling string module functions.

July 27, 2003
(grin) Php uses this ?>   <? to "quote" literal HTML.  It would look a little odd in D, though.

I was about to send this as a joke, but it occurs to me, especially if we plan to sometimes embed D in HTML, that HTML tags aren't necessarily a bad idea.  What about:

<wysiwyg>string</wysiwyg>

????

Burton Radons wrote:
> 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 27, 2003
LOL. What isn't? :)

"Walter" <walter@digitalmars.com> wrote in message news:bfv2s8$ql4$1@digitaldaemon.com...
>
> "Matthew Wilson" <matthew@stlsoft.org> wrote in message news:bfv0or$oeh$2@digitaldaemon.com...
> > Here's an unpopular thought: why not use @"string" and be consistent
with
> > C#? Easier on the brain even if it doffs one's cap to M$
>
> It's aesthetically unpleasing.
>
>


July 27, 2003
Ilya Minkov wrote:

> The difference to single quotes is hardly noticable if you have a 160dpi display and space is tight. :) Like, my main programming machine is a high-performace handheld notebook with a *really* tiny display. :) You can guess that i don't have sausage-like fingers. :)
> 
> The backquote is better left for something, which cannot be easily confused with strings.
> 
> Better a sane prefix (like Burton's r -- whatever it means it looks good) or """ """.
> 

What's sane? That's subjective ;-).

I like `string` because it's simple, clean, and easy.  The other ways look ugly, I think.  Not everybody uses a nasty, cramped laptop :-).

With all those syntax highlighting text editors out there, I don't think it's much of a problem setting special colours for the string to make it more obvious for those with small/dense displays, no?

Later,

John

July 27, 2003
That's what I'm trying to find!

"Matthew Wilson" <matthew@stlsoft.org> wrote in message news:bfv9m8$118q$1@digitaldaemon.com...
> LOL. What isn't? :)
>
> "Walter" <walter@digitalmars.com> wrote in message news:bfv2s8$ql4$1@digitaldaemon.com...
> >
> > "Matthew Wilson" <matthew@stlsoft.org> wrote in message news:bfv0or$oeh$2@digitaldaemon.com...
> > > Here's an unpopular thought: why not use @"string" and be consistent
> with
> > > C#? Easier on the brain even if it doffs one's cap to M$
> >
> > It's aesthetically unpleasing.
> >
> >
>
>


July 27, 2003

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).

Just a few thoughts.

I like
  'string' : wysiwyg strings
  "string" : escaped strings
the way it is (like Perl).

Perl uses an alternative Syntax for various types of quoting
("any nonwhitespace delimiter may be used in place of / "):
  q/.../ single quote
  qq/.../ double quote
  qr/.../ quote regex expression
  qx/.../ quote execution (instead of backtick)
  qw/.../ word lists
which seems quite handy and open for extensions

On the other hand what would happen if you changed the semantics of
  \n
to single character literal? The problems or ambiguities would
be different and perhaps easier to solve.

One may also note that VB uses ' and " identically. This is very
handy to build strings containing the opposite type of
quoting.
E. g. SQL: "SELECT * FROM Table WHERE Name='Peter';"
       or: 'SELECT * FROM Table WHERE Name="Peter";'
This would also simplify building HTML
  typical Perl: "<td width=\"1%\" align=\"right\">"
         VBish: '<td width="1%" align="right">'
(of course no-one will ever use VB to generate HTML for other reasons)

--
Helmut Leitner    leitner@hls.via.at Graz, Austria   www.hls-software.com
July 27, 2003
> With all those syntax highlighting text editors out there, I don't think it's much of a problem setting special colours for the string to make it more obvious for those with small/dense displays, no?

Excellent point