Re: Re: Multiline template strings that don't break indentation

2014-10-13 Thread Alexander Kit
On 19 September 2014 01:52, Domenic Denicola dome...@domenicdenicola.com wrote: ALL of these things can be accomplished with your own custom tag. Yes, it can be accomplished with the custom tag function. But this is not the argument, as also a lot of other things from ES6 spec can be

Re: Multiline template strings that don't break indentation

2014-10-13 Thread Brendan Eich
Alexander Kit wrote: On 19 September 2014 01:52, Domenic Denicola dome...@domenicdenicola.com mailto:dome...@domenicdenicola.com wrote: ALL of these things can be accomplished with your own custom tag. Yes, it can be accomplished with the custom tag function. But this is not the

Re: Re: Multiline template strings that don't break indentation

2014-09-18 Thread Merih
This might be beyond the current state of template strings but wouldn't it be nice if there was a delimiter character we can use to depict the beginning of each line of a multiline string? A similar solution like Scala multliline strings but without `stripMargin` method at the end. For example:

RE: Re: Multiline template strings that don't break indentation

2014-09-18 Thread Domenic Denicola
@mozilla.org Subject: Re: Re: Multiline template strings that don't break indentation This might be beyond the current state of template strings but wouldn't it be nice if there was a delimiter character we can use to depict the beginning of each line of a multiline string? A similar solution like

Re: Multiline template strings that don't break indentation

2014-09-12 Thread Salvador de la Puente González
On 12 Sep 2014 07:40, Sebastian Zartner sebastianzart...@gmail.com And if someone wants to use his own tag? Would he have to reimplement dontIndent or String.noIndentation by himself? What I meant above with tag concatenation would be something like this: AFAIK a couple of brackets around the

Re: Multiline template strings that don't break indentation

2014-09-12 Thread Marius Gundersen
On Fri, Sep 12, 2014 at 7:40 AM, Sebastian Zartner sebastianzart...@gmail.com wrote: And if someone wants to use his own tag? Would he have to reimplement dontIndent or String.noIndentation by himself? What I meant above with tag concatenation would be something like this: var a =

Re: Multiline template strings that don't break indentation

2014-09-12 Thread Kevin Smith
And if someone wants to use his own tag? Would he have to reimplement dontIndent or String.noIndentation by himself? I implemented exactly what you want (modulo de-indent specifics) here: https://gist.github.com/zenparsing/5dffde82d9acef19e43c This should be left in userland for now, I

Re: Multiline template strings that don't break indentation

2014-09-12 Thread Alexander Kit
On 10 September 2014 01:01, Andy Earnshaw andyearns...@gmail.com wrote: *Git and linting tools usually bark at you if you have trailing white space anyway* Template string is a literal, so any of the linter should not complain about the trailing whitespace inside, if so this should

Re: Multiline template strings that don't break indentation

2014-09-12 Thread Brendan Eich
Kevin Smith wrote: This should be left in userland for now, I think. Absolutely. The trick with design, to paraphrase N. Wirth, is leaving things out. With the right primitives (tag in front is function call short hand, you can compose function calls as Salvador showed), the usability is

Re: Multiline template strings that don't break indentation

2014-09-12 Thread C. Scott Ananian
On Fri, Sep 12, 2014 at 12:35 PM, Brendan Eich bren...@mozilla.org wrote: With the right primitives (tag in front is function call short hand, you can compose function calls as Salvador showed), the usability is fine and the core language avoids creature feep. Agreed, although I *would* like

Re: Multiline template strings that don't break indentation

2014-09-12 Thread Kevin Smith
Agreed, although I *would* like to see something very similar to Kevin's implementation added to the standard library (`String.dedent`?), so that a million authors don't reinvent the dedent function in multiple slightly-different ways. Yes - it sounds like it might be a good cowpath to

Re: Multiline template strings that don't break indentation

2014-09-11 Thread 李白|字一日
I would prefer var a = `This is a template string.` `Even though each line is indented to keep the` `code neat and tidy, the white space used to indent` `is not in the resulting string` keepindentation`; as a multiple line string, 2014-09-11 13:55 GMT+08:00 Sebastian Zartner

Re: Multiline template strings that don't break indentation

2014-09-11 Thread Salvador de la Puente González
Hi guys. Notice we are dealing with literals and I would want to keep the strings as literal as possible so I think this is a syntax issue as the programmatic solution like regexp substitution is always available. My proposal: var s = `This is a multiline string. It keeps literal unless

Re: Multiline template strings that don't break indentation

2014-09-11 Thread Brendan Eich
The tag goes at the front. What's missing from the design that can't be provided as a standard exported deindent function? /be Sebastian Zartner wrote: var a = `This is a template string. Even though each line is indented to keep the code neat and

Re: Multiline template strings that don't break indentation

2014-09-11 Thread Allen Wirfs-Brock
On Sep 11, 2014, at 1:05 AM, Brendan Eich wrote: The tag goes at the front. What's missing from the design that can't be provided as a standard exported deindent function? exactly: var a = dontIndent `This is a template string. Even though each line

Re: Multiline template strings that don't break indentation

2014-09-11 Thread Sebastian Zartner
The tag goes at the front. I know. I didn't see this functionality as a tag, though, but rather as a flag for the client. Having this functionality available as a tag has some consequences. See below. What's missing from the design that can't be provided as a standard exported deindent

Re: Multiline template strings that don't break indentation

2014-09-10 Thread Sebastian Zartner
On 9 September 2014 16:51, Allen Wirfs-Brock al...@wirfs-brock.com wrote: Well, just for fun const N = \n; //maybe we could find evocative unicode name. var a = `This is a template string. ${ N}Even though each line is indented to keep the ${

Multiline template strings that don't break indentation

2014-09-09 Thread Andy Earnshaw
Hi everyone, It's great to finally play around with template strings after noticing them in the latest Firefox nightly. However, I can't help but think we're repeating mistakes of the past when it comes to multiline strings and code tidiness. Back when I had to write PHP code I used to feel sad

Re: Multiline template strings that don't break indentation

2014-09-09 Thread Andrea Giammarchi
would anything like this work already for you ? ```js function myFunction () { var a = (`This is a template string. Even though each line is indented to keep the code neat and tidy, the white space used to indent is not in the

Re: Multiline template strings that don't break indentation

2014-09-09 Thread Boris Zbarsky
On 9/9/14, 4:18 AM, Andy Earnshaw wrote: It could be that I'm the only person who is this fussy and it doesn't bother anyone else, but I hope that's not the case. We ran into this with Python multiline strings as well when we were working on Gecko's binding generator. We (specifically Jason

Re: Multiline template strings that don't break indentation

2014-09-09 Thread Allen Wirfs-Brock
Well, just for fun const N = \n; //maybe we could find evocative unicode name. var a = `This is a template string. ${ N}Even though each line is indented to keep the ${ N}code neat and tidy, the white space used to indent ${ N}is not

Re: Multiline template strings that don't break indentation

2014-09-09 Thread Kevin Smith
You can create a really flexible dedent function/tag pretty easily: https://gist.github.com/zenparsing/5dffde82d9acef19e43c Nice, right? On Tue, Sep 9, 2014 at 10:51 AM, Allen Wirfs-Brock al...@wirfs-brock.com wrote: Well, just for fun const N = \n; //maybe we could find evocative

Re: Multiline template strings that don't break indentation

2014-09-09 Thread Alexander Kit
I would also hope that the trailing indentions will be cut off from the template string. We had the case in our template engine, multiline strings are supported and it behaives as follows: - first line: contains a non-whitespace character → take the complete string as is and exit, otherwise: -

Re: Multiline template strings that don't break indentation

2014-09-09 Thread Andy Earnshaw
Allen's is pretty clever and I'd be almost tempted to use it ;-) On Tue, Sep 9, 2014 at 4:44 PM, Kevin Smith zenpars...@gmail.com wrote: You can create a really flexible dedent function/tag pretty easily: https://gist.github.com/zenparsing/5dffde82d9acef19e43c Nice, right? I wrote a