https://forum.dlang.org/post/prlulfqvxrgrdzxot...@forum.dlang.org
On Tuesday, 10 November 2015 at 11:22:56 UTC, wobbles wrote:
int a = 1;
int b = 4;
writefln("The number %s is less than %s", a, b);
writeln("The number ",a, " is less than ",b);
Hi,
The only example of string interpolation I've found so far is on
Rosetta Code:
void main() {
import std.stdio, std.string;
"Mary had a %s lamb.".format("little").writeln;
"Mary had a %2$s %1$s lamb.".format("little",
"whi
Is there a fancy way to have some kind of string interpolation in
D?
does not match template declaration interp(X)
i.d(11): Error: template instance interp!"The number #{a} is less
than #{b}" does not match template declaration interp(X)
I'm wondering if this code has once worked? and seems
dpaste.dzfl.pl no longer there.
Can we do string interpol
On Wednesday, 20 May 2020 at 23:41:15 UTC, mw wrote:
Can we do string interpolation in D now?
There's an implementation in the dub package "scriptlike":
https://code.dlang.org/packages/scriptlike#string-interpolation
On Thursday, 21 May 2020 at 01:13:27 UTC, Paul Backus wrote:
On Wednesday, 20 May 2020 at 23:41:15 UTC, mw wrote:
Can we do string interpolation in D now?
There's an implementation in the dub package "scriptlike":
https://code.dlang.org/packages/scriptlike#string-interpolat
On Thursday, 21 May 2020 at 06:57:28 UTC, mw wrote:
On Thursday, 21 May 2020 at 01:13:27 UTC, Paul Backus wrote:
On Wednesday, 20 May 2020 at 23:41:15 UTC, mw wrote:
Can we do string interpolation in D now?
There's an implementation in the dub package "scriptlike":
https:/
On Thursday, 21 May 2020 at 06:57:28 UTC, mw wrote:
i.e how to write this 's'?
gimme a like on the proposal to add to the language!
https://github.com/dlang/DIPs/pull/186
If accepted, that would let you write
i"stuff here".idup
to get an interpolated string.
On Thursday, 21 May 2020 at 12:53:50 UTC, Adam D. Ruppe wrote:
On Thursday, 21 May 2020 at 06:57:28 UTC, mw wrote:
i.e how to write this 's'?
gimme a like on the proposal to add to the language!
https://github.com/dlang/DIPs/pull/186
If accepted, that would let you write
i"stuff here".idup
On Thursday, 21 May 2020 at 17:10:31 UTC, mw wrote:
BTW, is the .idup must be there?
It is discussed more in the github document but basically the
proposed built-in syntax returns a generic builder thing which
can make more than just strings. The idup specifically asks it to
make a copy into
On Thursday, 21 May 2020 at 18:12:01 UTC, ZK wrote:
I love the extensibility of this, but perhaps there should be
something like `ii"foo".idup` that's syntactic sugar for
`i"foo".idup`. New users might get confused by the need for
appending idup, and then they'll think about how other
language
On Thursday, 21 May 2020 at 17:17:49 UTC, Adam D. Ruppe wrote:
On Thursday, 21 May 2020 at 17:10:31 UTC, mw wrote:
BTW, is the .idup must be there?
It is discussed more in the github document but basically the
proposed built-in syntax returns a generic builder thing which
can make more than
On Thursday, 21 May 2020 at 06:57:28 UTC, mw wrote:
On Thursday, 21 May 2020 at 01:13:27 UTC, Paul Backus wrote:
On Wednesday, 20 May 2020 at 23:41:15 UTC, mw wrote:
Can we do string interpolation in D now?
There's an implementation in the dub package "scriptlike":
https:/
On Tuesday, 10 November 2015 at 10:21:32 UTC, tired_eyes wrote:
Hi,
The only example of string interpolation I've found so far is
on Rosetta Code:
void main() {
import std.stdio, std.string;
"Mary had a %s lamb.".format("little").writeln;
"Mary
On Tuesday, 10 November 2015 at 10:21:32 UTC, tired_eyes wrote:
Hi,
The only example of string interpolation I've found so far is
on Rosetta Code:
void main() {
import std.stdio, std.string;
"Mary had a %s lamb.".format("little").writeln;
"Mary
On Tuesday, 10 November 2015 at 10:33:30 UTC, Tobias Pankrath
wrote:
On Tuesday, 10 November 2015 at 10:21:32 UTC, tired_eyes wrote:
Hi,
The only example of string interpolation I've found so far is
on Rosetta Code:
void main() {
import std.stdio, std.string;
"Mary had
On Tuesday, 10 November 2015 at 10:41:52 UTC, tired_eyes wrote:
On Tuesday, 10 November 2015 at 10:33:30 UTC, Tobias Pankrath
wrote:
On Tuesday, 10 November 2015 at 10:21:32 UTC, tired_eyes wrote:
[...]
std.string.format and std.format are the standard options.
What are you missing?
Ruby:
On Tuesday, 10 November 2015 at 10:41:52 UTC, tired_eyes wrote:
On Tuesday, 10 November 2015 at 10:33:30 UTC, Tobias Pankrath
wrote:
Ruby:
a = 1
b = 4
puts "The number #{a} is less than #{b}"
PHP:
$a = 1;
$b = 4;
echo "The number $a is less than $b";
D:
???
int a = 1, b = 4;
writefln("The nu
On Tuesday, 10 November 2015 at 11:22:56 UTC, wobbles wrote:
On Tuesday, 10 November 2015 at 10:41:52 UTC, tired_eyes wrote:
On Tuesday, 10 November 2015 at 10:33:30 UTC, Tobias Pankrath
wrote:
On Tuesday, 10 November 2015 at 10:21:32 UTC, tired_eyes
wrote:
[...]
std.string.format and std.fo
On Tuesday, 10 November 2015 at 11:29:32 UTC, TheFlyingFiddle
wrote:
On Tuesday, 10 November 2015 at 10:41:52 UTC, tired_eyes wrote:
On Tuesday, 10 November 2015 at 10:33:30 UTC, Tobias Pankrath
wrote:
Ruby:
a = 1
b = 4
puts "The number #{a} is less than #{b}"
PHP:
$a = 1;
$b = 4;
echo "The nu
On Tuesday, 10 November 2015 at 11:29:32 UTC, TheFlyingFiddle
wrote:
On Tuesday, 10 November 2015 at 10:41:52 UTC, tired_eyes wrote:
On Tuesday, 10 November 2015 at 10:33:30 UTC, Tobias Pankrath
wrote:
Ruby:
a = 1
b = 4
puts "The number #{a} is less than #{b}"
PHP:
$a = 1;
$b = 4;
echo "The nu
On Tuesday, 10 November 2015 at 12:40:07 UTC, Márcio Martins
wrote:
writeln(interp!"The number #{a} is less than #{b}");
Quite pleasant syntax this way :)
Not sure if it's feasible to do this on the language side.
Yes. Here a (stupid!) proof of concept:
http://dpaste.dzfl.pl/74b1a4e3c8c6
On Wednesday, 6 January 2016 at 23:30:22 UTC, Guillaume Piolat
wrote:
Is there a fancy way to have some kind of string interpolation
in D?
Other than std.format.format that is?
On Wednesday, 6 January 2016 at 23:30:22 UTC, Guillaume Piolat
wrote:
Is there a fancy way to have some kind of string interpolation
in D?
This is probably the best you're going to be able to do in D in
regards to string interpolation.
https://github.com/Abscissa/scriptlike#s
stallation
folder
Example:
```
copy generated\windows\release\64\dmd.exe C:\d\dmd2\windows\bin64
```
Copy druntime/src/core/interpolation.d to your corresponding
druntime folder + import
Example:
```
copy druntime/src/core/interpolation.d
C:\d\dmd2\src\druntime\import\core\
```
Now
On Friday, 20 October 2023 at 16:41:40 UTC, Imperatorn wrote:
Here's a script to get you started
```bash
git clone https://github.com/adamdruppe/dmd.git
cd dmd
git checkout interp
rdmd compiler/src/build.d
```
[...]
We just need support for it in the tools, then D will be a Dream
come true
On Friday, 20 October 2023 at 16:41:40 UTC, Imperatorn wrote:
Here's a script to get you started
Same instructions for DIP1027:
```
git clone https://github.com/WalterBright/dmd.git
cd dmd
git checkout dip1027
rdmd compiler/src/build.d
```
Then same instructions as above but without the need
On Friday, 20 October 2023 at 16:41:40 UTC, Imperatorn wrote:
Here's a script to get you started
...
Now try string interpolation:
```d
import std.stdio;
void main()
{
string name = "Johan";
int age = 37;
int iq = 8001;
int coffees = 1000;
On Monday, 23 October 2023 at 11:12:20 UTC, matheus wrote:
On Friday, 20 October 2023 at 16:41:40 UTC, Imperatorn wrote:
Here's a script to get you started
...
Now try string interpolation:
```d
import std.stdio;
void main()
{
string name = "Johan";
int age =
On Monday, 23 October 2023 at 11:43:33 UTC, Imperatorn wrote:
On Monday, 23 October 2023 at 11:12:20 UTC, matheus wrote:
On Friday, 20 October 2023 at 16:41:40 UTC, Imperatorn wrote:
[...]
First of all thanks for writing this.
Well this seems pretty nice... What DIP number is this? - I'd
li
30 matches
Mail list logo