digitalmars.D.learn - Want to try out string interpolation in D?
- Imperatorn (41/41) Oct 20 2023 Here's a script to get you started
- Imperatorn (3/11) Oct 20 2023 We just need support for it in the tools, then D will be a Dream
- Imperatorn (10/11) Oct 22 2023 Same instructions for DIP1027:
- matheus (5/26) Oct 23 2023 First of all thanks for writing this.
- Imperatorn (7/37) Oct 23 2023 Which one did you try?
- Imperatorn (2/18) Oct 27 2023 Note: The YAIDIP is now superseed by the 1036e.
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 ``` I don't want to copy files anywhere, so the user has to do that manually: Copy dmd from the generated executable to your D bin installation 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 try string interpolation: ```d import std.stdio; void main() { string name = "Johan"; int age = 37; int iq = 8001; int coffees = 1000; writeln(i"Your name is $name and you're $age years old"); writeln(i"You drink $coffees cups a day and it gives you $(coffees + iq) IQ"); } ``` Output: ``` Your name is Johan and you're 37 years old You drink 1000 cups a day and it gives you 9001 IQ ```
Oct 20 2023
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
Oct 20 2023
On Friday, 20 October 2023 at 16:41:40 UTC, Imperatorn wrote:Here's a script to get you startedSame 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 to copy interpolation.d
Oct 22 2023
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; writeln(i"Your name is $name and you're $age years old"); writeln(i"You drink $coffees cups a day and it gives you $(coffees + iq) IQ"); } ``` Output: ``` Your name is Johan and you're 37 years old You drink 1000 cups a day and it gives you 9001 IQ ```First of all thanks for writing this. Well this seems pretty nice... What DIP number is this? - I'd like to read why it was rejected. Matheus.
Oct 23 2023
On Monday, 23 October 2023 at 11:12:20 UTC, matheus wrote:On Friday, 20 October 2023 at 16:41:40 UTC, Imperatorn wrote:Which one did you try? The first one is YAIDIP: https://github.com/John-Colvin/YAIDIP and the second one is DIP1027: https://github.com/dlang/DIPs/blob/master/DIPs/rejected/DIP1027.md Make sure you try them bothHere'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; writeln(i"Your name is $name and you're $age years old"); writeln(i"You drink $coffees cups a day and it gives you $(coffees + iq) IQ"); } ``` Output: ``` Your name is Johan and you're 37 years old You drink 1000 cups a day and it gives you 9001 IQ ```First of all thanks for writing this. Well this seems pretty nice... What DIP number is this? - I'd like to read why it was rejected. Matheus.
Oct 23 2023
On Monday, 23 October 2023 at 11:43:33 UTC, Imperatorn wrote:On Monday, 23 October 2023 at 11:12:20 UTC, matheus wrote:Note: The YAIDIP is now superseed by the 1036e.On Friday, 20 October 2023 at 16:41:40 UTC, Imperatorn wrote:Which one did you try? The first one is YAIDIP: https://github.com/John-Colvin/YAIDIP and the second one is DIP1027: https://github.com/dlang/DIPs/blob/master/DIPs/rejected/DIP1027.md Make sure you try them both[...]First of all thanks for writing this. Well this seems pretty nice... What DIP number is this? - I'd like to read why it was rejected. Matheus.
Oct 27 2023