October 07, 2008 Re: When will D get this feature? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Jarrett Billingsley | Tue, 7 Oct 2008 12:29:35 -0400,
Jarrett Billingsley wrote:
> On Tue, Oct 7, 2008 at 11:41 AM, Andrei Alexandrescu <SeeWebsiteForEmail@erdani.org> wrote:
> > KennyTM~ wrote:
> >>
> >> Jarrett Billingsley wrote:
> >>>
> >>> On Tue, Oct 7, 2008 at 9:56 AM, KennyTM~ <kennytm@gmail.com> wrote:
> >>>>
> >>>> Benji Smith wrote:
> >>>>>
> >>>>> http://www.xs4all.nl/~weegen/eelis/analogliterals.xhtml
> >>>>>
> >>>>> ;-)
> >>>>>
> >>>>> --benji
> >>>>
> >>>> Because of the \ in the source code D can't parse this even if all the template stuffs are translated.
> >>>>
> >>>> Unless Walter clarifies what \ means outside a string (currently \n in
> >>>> the
> >>>> source code is directly translated to "\n". So
> >>>>
> >>>> writefln("Hello" \n "world");
> >>>>
> >>>> is, em, valid.)
> >>>>
> >>>
> >>> Erm, it is defined. See "escape strings" here: http://www.digitalmars.com/d/1.0/lex.html
> >>
> >> Oh I see.
> >
> > In wake of the recent comments on q{string}, I have the feeling this is a mistake of the same proportion as q{string}. It essentially hijacks "\" for pretty much all uses (lambdas were an idea) for the sake of a feature that is gratuitous and useless.
>
> FWIW I have *never* seen escape strings used. They are a complete waste of a symbol, it seems.
I've got this in my code:
// a newline sequence to be used for adding new lines, default is DOS char[] g_NewLine = \r\n;
Not that it saves much typing.
| |||
October 07, 2008 Re: When will D get this feature? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Ary Borenszweig | Tom S uses it in some of his code.
For making wysiwyg strings that have a newline at the end:
string x = `This string is \wysiwyg\ but ends with newline`\n ;
Course you could do that with "\n" instead of \n at the end, too.
--bb
On Wed, Oct 8, 2008 at 12:51 AM, Ary Borenszweig <ary@esperanto.org.ar> wrote:
> Andrei Alexandrescu wrote:
>>
>> KennyTM~ wrote:
>>>
>>> Jarrett Billingsley wrote:
>>>>
>>>> On Tue, Oct 7, 2008 at 9:56 AM, KennyTM~ <kennytm@gmail.com> wrote:
>>>>>
>>>>> Benji Smith wrote:
>>>>>>
>>>>>> http://www.xs4all.nl/~weegen/eelis/analogliterals.xhtml
>>>>>>
>>>>>> ;-)
>>>>>>
>>>>>> --benji
>>>>>
>>>>> Because of the \ in the source code D can't parse this even if all the template stuffs are translated.
>>>>>
>>>>> Unless Walter clarifies what \ means outside a string (currently \n in
>>>>> the
>>>>> source code is directly translated to "\n". So
>>>>>
>>>>> writefln("Hello" \n "world");
>>>>>
>>>>> is, em, valid.)
>>>>>
>>>>
>>>> Erm, it is defined. See "escape strings" here: http://www.digitalmars.com/d/1.0/lex.html
>>>
>>> Oh I see.
>>
>> In wake of the recent comments on q{string}, I have the feeling this is a mistake of the same proportion as q{string}. It essentially hijacks "\" for pretty much all uses (lambdas were an idea) for the sake of a feature that is gratuitous and useless.
>
> Who is using q{} and \n in real code? Why that was introduced? What was the problem with normal string literals?
>
| |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply