Jump to page: 1 224  
Page
Thread overview
DIP 1027---String Interpolation---Community Review Round 1
Dec 11, 2019
Mike Parker
Dec 11, 2019
Walter Bright
Dec 11, 2019
Rumbu
Dec 11, 2019
MrSmith
Dec 11, 2019
rumbu
Dec 11, 2019
drug
Dec 11, 2019
Patrick Schluter
Dec 11, 2019
Alexandru Ermicioi
Dec 11, 2019
MrSmith
Dec 11, 2019
Alexandru Ermicioi
Dec 11, 2019
Adam D. Ruppe
Dec 11, 2019
jmh530
Dec 11, 2019
jmh530
Dec 11, 2019
Patrick Schluter
Dec 11, 2019
Alexandru Ermicioi
Dec 14, 2019
Walter Bright
Dec 14, 2019
Walter Bright
Dec 14, 2019
Walter Bright
Dec 14, 2019
Tove
Dec 14, 2019
mipri
Dec 15, 2019
Alexandru Ermicioi
Dec 16, 2019
Nick Treleaven
Dec 11, 2019
Sebastiaan Koppe
Dec 11, 2019
bachmeier
Dec 11, 2019
jmh530
Dec 14, 2019
Walter Bright
Dec 14, 2019
Walter Bright
Dec 11, 2019
bachmeier
Dec 14, 2019
Walter Bright
Dec 11, 2019
Andrea Fontana
Dec 11, 2019
Andrea Fontana
Dec 11, 2019
Andre Pany
Dec 11, 2019
Adam D. Ruppe
Dec 11, 2019
Andrea Fontana
Dec 14, 2019
Walter Bright
Dec 11, 2019
Rumbu
Dec 11, 2019
Adam D. Ruppe
Dec 14, 2019
Walter Bright
Dec 11, 2019
Patrick Schluter
Dec 11, 2019
Alexandru Ermicioi
Dec 11, 2019
Patrick Schluter
Dec 11, 2019
Meta
Dec 14, 2019
Walter Bright
Dec 11, 2019
Sebastiaan Koppe
Dec 14, 2019
Walter Bright
Dec 11, 2019
Patrick Schluter
Dec 14, 2019
Walter Bright
Dec 14, 2019
Bastiaan Veelo
Dec 11, 2019
Anonymouse
Dec 14, 2019
Walter Bright
Dec 11, 2019
Robert Schadek
Dec 11, 2019
Meta
Dec 11, 2019
Meta
Dec 11, 2019
Bastiaan Veelo
Dec 12, 2019
Paul Backus
Dec 14, 2019
Walter Bright
Dec 11, 2019
Patrick Schluter
Dec 14, 2019
Walter Bright
Dec 11, 2019
H. S. Teoh
Dec 14, 2019
Walter Bright
Dec 14, 2019
Jacob Carlborg
Dec 15, 2019
Walter Bright
Dec 15, 2019
Walter Bright
Dec 17, 2019
Walter Bright
Dec 17, 2019
Alexandru Ermicioi
Dec 14, 2019
Meta
Dec 11, 2019
Andrea Fontana
Dec 11, 2019
H. S. Teoh
Dec 13, 2019
Robert M. Münch
Dec 14, 2019
Walter Bright
Dec 11, 2019
Bastiaan Veelo
Dec 11, 2019
Bastiaan Veelo
Dec 14, 2019
Walter Bright
Dec 15, 2019
Walter Bright
Dec 14, 2019
Walter Bright
Dec 14, 2019
Walter Bright
Dec 11, 2019
mipri
Dec 12, 2019
mipri
Dec 12, 2019
aliak
Dec 12, 2019
Adam D. Ruppe
Dec 12, 2019
aliak
Dec 12, 2019
H. S. Teoh
Dec 12, 2019
aliak
Dec 12, 2019
Adam D. Ruppe
Dec 13, 2019
Andrea Fontana
Dec 16, 2019
aliak
Dec 16, 2019
H. S. Teoh
Dec 12, 2019
Adam D. Ruppe
Dec 12, 2019
Atila Neves
Dec 13, 2019
mipri
Dec 13, 2019
mipri
Dec 13, 2019
Adam D. Ruppe
Dec 13, 2019
mipri
Dec 13, 2019
Adam D. Ruppe
Dec 13, 2019
Timon Gehr
Dec 13, 2019
Adam D. Ruppe
Dec 12, 2019
Sebastiaan Koppe
Dec 14, 2019
Walter Bright
Dec 14, 2019
Jacob Carlborg
Dec 14, 2019
Adam D. Ruppe
Dec 14, 2019
Adam D. Ruppe
Dec 15, 2019
Walter Bright
Dec 15, 2019
Adam D. Ruppe
Dec 15, 2019
Walter Bright
Dec 15, 2019
Jab
Dec 15, 2019
Guillaume Piolat
Dec 15, 2019
Jab
Dec 15, 2019
Aliak
Dec 16, 2019
Walter Bright
Dec 16, 2019
aliak
Dec 16, 2019
Patrick Schluter
Dec 16, 2019
Patrick Schluter
Dec 16, 2019
Jacob Carlborg
Dec 16, 2019
Patrick Schluter
Dec 17, 2019
Jacob Carlborg
Dec 17, 2019
Patrick Schluter
Dec 17, 2019
Jacob Carlborg
Dec 17, 2019
Patrick Schluter
Dec 17, 2019
mipri
Dec 17, 2019
mipri
Dec 17, 2019
ag0aep6g
Dec 17, 2019
Meta
Dec 17, 2019
Alexandru Ermicioi
Dec 17, 2019
aliak
Dec 18, 2019
Patrick Schluter
Dec 17, 2019
Alexandru Ermicioi
Dec 16, 2019
aliak
Dec 16, 2019
Patrick Schluter
Dec 16, 2019
Patrick Schluter
Dec 16, 2019
aliak
Dec 16, 2019
Atila Neves
Dec 16, 2019
Nick Treleaven
Dec 16, 2019
Walter Bright
Dec 17, 2019
Jacob Carlborg
Dec 17, 2019
Jacob Carlborg
Dec 17, 2019
Nick Treleaven
Dec 16, 2019
aliak
Dec 16, 2019
aliak
Dec 16, 2019
mipri
Dec 15, 2019
Alexandru Ermicioi
Dec 15, 2019
rikki cattermole
Dec 16, 2019
Walter Bright
Dec 17, 2019
Alexandru Ermicioi
Dec 21, 2019
Walter Bright
Dec 15, 2019
Andre Pany
Dec 15, 2019
Guillaume Piolat
Dec 15, 2019
Jab
Dec 15, 2019
Adam D. Ruppe
Dec 15, 2019
mipri
Dec 15, 2019
Adam D. Ruppe
Dec 16, 2019
Walter Bright
Dec 15, 2019
Jab
Dec 15, 2019
Adam D. Ruppe
Dec 15, 2019
Jab
Dec 15, 2019
Guillaume Piolat
Dec 15, 2019
Jab
Dec 15, 2019
Adam D. Ruppe
Dec 16, 2019
Guillaume Piolat
Dec 15, 2019
Seb
Dec 13, 2019
Walter Bright
Dec 13, 2019
mipri
Dec 12, 2019
aliak
Dec 12, 2019
Jonathan Marler
Dec 14, 2019
Walter Bright
Dec 13, 2019
Jacob Carlborg
Dec 14, 2019
Walter Bright
Dec 14, 2019
Jacob Carlborg
Dec 14, 2019
Tim
Dec 15, 2019
Guillaume Piolat
Dec 16, 2019
Walter Bright
Dec 16, 2019
mipri
Dec 16, 2019
Patrick Schluter
Dec 16, 2019
mipri
Dec 17, 2019
Jab
Dec 17, 2019
mipri
Dec 17, 2019
Walter Bright
Dec 17, 2019
mipri
Dec 17, 2019
Jab
Dec 17, 2019
H. S. Teoh
Dec 17, 2019
Walter Bright
Dec 17, 2019
Jacob Carlborg
[OT] new thing I learned for today
Dec 18, 2019
Atila Neves
Dec 18, 2019
jmh530
Dec 18, 2019
jmh530
Dec 18, 2019
Mike Parker
Dec 20, 2019
mipri
Dec 26, 2019
aberba
Dec 26, 2019
Patrick Schluter
Dec 26, 2019
Mike Parker
Dec 26, 2019
Jab
Dec 26, 2019
Mike Parker
December 11, 2019
This is the feedback thread for the first round of Community Review for DIP 1027, "String Interpolation":

https://github.com/dlang/DIPs/blob/148001a963f5d6e090bb6beef5caf9854372d0bc/DIPs/DIP1027.md

All review-related feedback on and discussion of the DIP should occur in this thread. The review period will end at 11:59 PM ET on December 25, or when I make a post declaring it complete.

At the end of Round 1, if further review is deemed necessary, the DIP will be scheduled for another round of Community Review. Otherwise, it will be queued for the Final Review and Formal Assessment.

Anyone intending to post feedback in this thread is expected to be familiar with the reviewer guidelines:

https://github.com/dlang/DIPs/blob/master/docs/guidelines-reviewers.md

*Please stay on topic!*

Thanks in advance to all who participate.
December 11, 2019
> printf("I ate %s and %d totalling %s fruit.\n", apples, bananas, apples + bananas);

Gaah, that should be:

  printf("I ate %d and %d totalling %d fruit.\n", apples, bananas, apples + bananas);
December 11, 2019
On Wednesday, 11 December 2019 at 09:52:21 UTC, Mike Parker wrote:
> This is the feedback thread for the first round of Community Review for DIP 1027, "String Interpolation":
>
> https://github.com/dlang/DIPs/blob/148001a963f5d6e090bb6beef5caf9854372d0bc/DIPs/DIP1027.md
>

So we cannot have variables named d, s, f, g, x and so on because they are standard format specifiers. What happens with custom format specifiers, any one letter variable cannot be interpolated?


Why reinvent the wheel and not adopt the common wisdom of {var} as in python, c# an even c++ 20?




December 11, 2019
On Wednesday, 11 December 2019 at 09:52:21 UTC, Mike Parker wrote:
> This is the feedback thread for the first round of Community Review for DIP 1027, "String Interpolation":
>
> https://github.com/dlang/DIPs/blob/148001a963f5d6e090bb6beef5caf9854372d0bc/DIPs/DIP1027.md
>
> All review-related feedback on and discussion of the DIP should occur in this thread. The review period will end at 11:59 PM ET on December 25, or when I make a post declaring it complete.
>
> At the end of Round 1, if further review is deemed necessary, the DIP will be scheduled for another round of Community Review. Otherwise, it will be queued for the Final Review and Formal Assessment.
>
> Anyone intending to post feedback in this thread is expected to be familiar with the reviewer guidelines:
>
> https://github.com/dlang/DIPs/blob/master/docs/guidelines-reviewers.md
>
> *Please stay on topic!*
>
> Thanks in advance to all who participate.

Why not just split interpolated string into just a tuple of args & strings. For example:
Given: (i"I ate %apples and %bananas totalling %(apples + bananas) fruit.")
Is lowered to a tuple: ("I ate ", apples, " and ", bananas," totalling ", apples + bananas," fruit.")

It seems current version unnecessarily ties to printf formatting syntax, and makes harder for them to be used in custom user code.

Also user still needs call a function to get assembled string which differs from what other languages are doing with interpolated strings.

Best regards,
Alexandru.
December 11, 2019
On Wednesday, 11 December 2019 at 10:48:56 UTC, Rumbu wrote:
> So we cannot have variables named d, s, f, g, x and so on because they are standard format specifiers. What happens with custom format specifiers, any one letter variable cannot be interpolated?

According to proposal you would wrap format specifiers into {}, like i"%{d}bananas"
December 11, 2019
On Wednesday, 11 December 2019 at 10:57:13 UTC, Alexandru Ermicioi wrote:
> Why not just split interpolated string into just a tuple of args & strings. For example:
> Given: (i"I ate %apples and %bananas totalling %(apples + bananas) fruit.")
> Is lowered to a tuple: ("I ate ", apples, " and ", bananas," totalling ", apples + bananas," fruit.")

That's an option, but one would also need to figure out handling of format specifiers


December 11, 2019
On Wednesday, 11 December 2019 at 09:52:21 UTC, Mike Parker wrote:
> This is the feedback thread for the first round of Community Review for DIP 1027, "String Interpolation":
>
> https://github.com/dlang/DIPs/blob/148001a963f5d6e090bb6beef5caf9854372d0bc/DIPs/DIP1027.md

Nice!

I just have a few nitpicks:

- I don't mind the required prefix 'i', but what about q{} strings? I probably want to use interpolation there as well

- I know it is bikeshedding but since string interpolation is 99% syntax, I vote for "either a single $colon for variables or ${expression} for expressions", like literally every other modern language.

Besides that, this is really nice.
December 11, 2019
On Wednesday, 11 December 2019 at 10:57:13 UTC, Alexandru Ermicioi wrote:
> Why not just split interpolated string into just a tuple of args & strings. For example:
> Given: (i"I ate %apples and %bananas totalling %(apples + bananas) fruit.")
> Is lowered to a tuple: ("I ate ", apples, " and ", bananas," totalling ", apples + bananas," fruit.")
>
> It seems current version unnecessarily ties to printf formatting syntax, and makes harder for them to be used in custom user code.

Agree. Your suggestion is much more in line with metaprogramming and offers the right flexibility.

Although I think you should just use braces.

Also, change the prefix to "f", so  that is is similar to other languages like Python.

So you could get:

log(f"I have {dec(3,2)}{account.total} USD in my pocket")

Becomes
log("I have ", dec(3,2), account.total," USD in my pocket")

That way people can use modern custom formatters if the called function knows how to deal with it.


printf is archaic and hardcoding it into the language just makes the language stuck.


December 11, 2019
On Wednesday, 11 December 2019 at 11:00:12 UTC, MrSmith wrote:
> On Wednesday, 11 December 2019 at 10:48:56 UTC, Rumbu wrote:
>> So we cannot have variables named d, s, f, g, x and so on because they are standard format specifiers. What happens with custom format specifiers, any one letter variable cannot be interpolated?
>
> According to proposal you would wrap format specifiers into {}, like i"%{d}bananas"

Nope, that means "use %d format specifier to print number of bananas". According to the DIP, this is invalid:

string what = "bread";
int d = 10;
writefln(i"making %what using %d ingredients");


December 11, 2019
On Wednesday, 11 December 2019 at 11:21:08 UTC, Ola Fosheim Grøstad wrote:
> log(f"I have {dec(3,2)}{account.total} USD in my pocket")
>
> Becomes
> log("I have ", dec(3,2), account.total," USD in my pocket")

Actually, make that a tuple, but add proper tuples first. So that you can write

   log("Vector {vec_formatter(3,2)}{myvec} is ready.", log_channel)

and it becomes

   log (〈"Vector ", vec_formatter(3,2), myvec, " is ready."〉, log_channel )

Where «〈» and «〉» signifies the language-builtin tuple.

« First   ‹ Prev
1 2 3 4 5 6 7 8 9 10 11