Re: Are Delimited strings and HereDoc strings just here to suck ?

2014-08-11 Thread Klaus via Digitalmars-d-learn
On Monday, 11 August 2014 at 22:24:28 UTC, Brian Schott wrote: On Monday, 11 August 2014 at 22:20:54 UTC, Brian Schott wrote: On Monday, 11 August 2014 at 19:47:46 UTC, Klaus wrote: I mean when writing a D lexer, you necessarly reach the moment when you think: "Oh no! is this feature just her

Re: Are Delimited strings and HereDoc strings just here to suck ?

2014-08-11 Thread Klaus via Digitalmars-d-learn
On Monday, 11 August 2014 at 22:56:27 UTC, Klaus wrote: On Monday, 11 August 2014 at 22:24:28 UTC, Brian Schott wrote: On Monday, 11 August 2014 at 22:20:54 UTC, Brian Schott wrote: On Monday, 11 August 2014 at 19:47:46 UTC, Klaus wrote: I mean when writing a D lexer, you necessarly reach the

Re: Are Delimited strings and HereDoc strings just here to suck ?

2014-08-11 Thread Brian Schott via Digitalmars-d-learn
On Monday, 11 August 2014 at 22:20:54 UTC, Brian Schott wrote: On Monday, 11 August 2014 at 19:47:46 UTC, Klaus wrote: I mean when writing a D lexer, you necessarly reach the moment when you think: "Oh no! is this feature just here to suck ?" They are and they do. Also, use this: https://g

Re: Are Delimited strings and HereDoc strings just here to suck ?

2014-08-11 Thread Brian Schott via Digitalmars-d-learn
On Monday, 11 August 2014 at 19:47:46 UTC, Klaus wrote: I mean when writing a D lexer, you necessarly reach the moment when you think: "Oh no! is this feature just here to suck ?" They are and they do.

Re: Are Delimited strings and HereDoc strings just here to suck ?

2014-08-11 Thread Philippe Sigaud via Digitalmars-d-learn
On Mon, Aug 11, 2014 at 10:58 PM, H. S. Teoh via Digitalmars-d-learn wrote: > In Flex, one way you can implement heredocs is to have a separate "mode" > where the lexer is scanning for the ending string. So basically you > have a sub-lexer that treats the heredoc as three tokens, one that > defi

Re: Are Delimited strings and HereDoc strings just here to suck ?

2014-08-11 Thread Klaus via Digitalmars-d-learn
f built-in help text, for example. Delimited strings are useful when writing code/text generators when you need to be able to use ' and " as literal characters without crazy leaning-toothpick syndrome \"x\"y\"z\"w\"'s sprinkled everywhere. The crazy variety

Re: Are Delimited strings and HereDoc strings just here to suck ?

2014-08-11 Thread H. S. Teoh via Digitalmars-d-learn
On Mon, Aug 11, 2014 at 10:50:34PM +0200, Philippe Sigaud via Digitalmars-d-learn wrote: > On Mon, Aug 11, 2014 at 10:09 PM, H. S. Teoh via Digitalmars-d-learn > wrote: > > On Mon, Aug 11, 2014 at 07:47:44PM +, Klaus via Digitalmars-d-learn > > wrote: > >> I mean when writing a D lexer, you

Re: Are Delimited strings and HereDoc strings just here to suck ?

2014-08-11 Thread Philippe Sigaud via Digitalmars-d-learn
On Mon, Aug 11, 2014 at 10:09 PM, H. S. Teoh via Digitalmars-d-learn wrote: > On Mon, Aug 11, 2014 at 07:47:44PM +, Klaus via Digitalmars-d-learn wrote: >> I mean when writing a D lexer, you necessarly reach the moment when >> you think: >> >> "Oh no! is this feature just here to suck ?" > T

Re: Are Delimited strings and HereDoc strings just here to suck ?

2014-08-11 Thread H. S. Teoh via Digitalmars-d-learn
strings in my program. It's one of the things I *like* about D, in fact. Nobody wants to manually parenthesize every quoted line with '"...\n"' when the program need to incorporate several pages of built-in help text, for example. Delimited strings are useful when writing c

Are Delimited strings and HereDoc strings just here to suck ?

2014-08-11 Thread Klaus via Digitalmars-d-learn
I mean when writing a D lexer, you necessarly reach the moment when you think: "Oh no! is this feature just here to suck ?"

Re: Delimited strings

2012-02-14 Thread Timon Gehr
On 02/15/2012 02:03 AM, H. S. Teoh wrote: On Wed, Feb 15, 2012 at 01:46:51AM +0100, Timon Gehr wrote: [...] No, q"abca" is illegal. The pattern is q"identifier string identifier" (The terminating new line is kept, so the string in this case is "string\n") I see. The online specs need to be c

Re: Delimited strings

2012-02-14 Thread H. S. Teoh
On Wed, Feb 15, 2012 at 01:46:51AM +0100, Timon Gehr wrote: [...] > No, q"abca" is illegal. The pattern is > > q"identifier > string > identifier" > > (The terminating new line is kept, so the string in this case is > "string\n") I see. The online specs need to be clarified, then. [...] > >So

Re: Delimited strings

2012-02-14 Thread Timon Gehr
On 02/15/2012 01:38 AM, H. S. Teoh wrote: I've finally got my lexer to the point where it can successfully tokenize /usr/include/d2/4.3.2/std/*.d. Yay! :-) Now I'm going back to fill in the gaps that still haven't been implemented yet. Among which are delimited strings. Accordin

Delimited strings

2012-02-14 Thread H. S. Teoh
I've finally got my lexer to the point where it can successfully tokenize /usr/include/d2/4.3.2/std/*.d. Yay! :-) Now I'm going back to fill in the gaps that still haven't been implemented yet. Among which are delimited strings. According to the online specs, delimited strin

Re: What are delimited strings good for?

2011-04-11 Thread Stewart Gordon
On 10/04/2011 21:51, Jonathan M Davis wrote: If that had been `something instead of 'something, _then_ the delimited string becomes useful, but given how rarely backticks are needed, it does seem rather odd to have delimited strings just for that. So, I definitely have to wonder why they

Re: What are delimited strings good for?

2011-04-10 Thread Ary Manzana
On 4/10/11 5:51 PM, Jonathan M Davis wrote: On 4/10/11 11:03 AM, simendsjo wrote: Ref http://digitalmars.com/d/2.0/lex.html What are some possible use cases for delimited strings? What is solved by having this in the language? Readability. auto s = "This is 'something' that

Re: What are delimited strings good for?

2011-04-10 Thread Jonathan M Davis
> On 4/10/11 11:03 AM, simendsjo wrote: > > Ref http://digitalmars.com/d/2.0/lex.html > > > > What are some possible use cases for delimited strings? > > What is solved by having this in the language? > > Readability. > > auto s = "This is 's

Re: What are delimited strings good for?

2011-04-10 Thread Ary Manzana
On 4/10/11 11:03 AM, simendsjo wrote: Ref http://digitalmars.com/d/2.0/lex.html What are some possible use cases for delimited strings? What is solved by having this in the language? Readability. auto s = "This is 'something' that \"could\" have been made easier to

Re: What are delimited strings good for?

2011-04-10 Thread Andrej Mitrovic
Hmm.. Well then, those I've never seen used before. :)

Re: What are delimited strings good for?

2011-04-10 Thread simendsjo
On 10.04.2011 21:17, Andrej Mitrovic wrote: Are we forgetting the fact that using delimited strings allows us to have syntax highlighting in editors? E.g.: void stringParser(string str)() { mixin(str); } void main() { stringParser!(q{ int x = 1; int y = 2

Re: What are delimited strings good for?

2011-04-10 Thread Andrej Mitrovic
Are we forgetting the fact that using delimited strings allows us to have syntax highlighting in editors? E.g.: void stringParser(string str)() { mixin(str); } void main() { stringParser!(q{ int x = 1; int y = 2; writefln("%s %s", x, y); }); }

Re: What are delimited strings good for?

2011-04-10 Thread Jonathan M Davis
> On 10/04/2011 17:51, Jonathan M Davis wrote: > >> Ref http://digitalmars.com/d/2.0/lex.html > >> > >> What are some possible use cases for delimited strings? > >> What is solved by having this in the language? > > > > It's probably so

Re: What are delimited strings good for?

2011-04-10 Thread Spacen Jasset
On 10/04/2011 17:51, Jonathan M Davis wrote: Ref http://digitalmars.com/d/2.0/lex.html What are some possible use cases for delimited strings? What is solved by having this in the language? It's probably so that you can still use characters that require escaping in the string without h

Re: What are delimited strings good for?

2011-04-10 Thread Jonathan M Davis
> Ref http://digitalmars.com/d/2.0/lex.html > > What are some possible use cases for delimited strings? > What is solved by having this in the language? It's probably so that you can still use characters that require escaping in the string without having to escape " ever

What are delimited strings good for?

2011-04-10 Thread simendsjo
Ref http://digitalmars.com/d/2.0/lex.html What are some possible use cases for delimited strings? What is solved by having this in the language?