October 23, 2023

On Monday, 23 October 2023 at 12:03:04 UTC, Arafel wrote:

>

On 23/10/23 13:47, Imperatorn wrote:

>

Just a quick comment. When posting code, be sure to check the "Enable Markdown" checkbox to the right of the send button.

Unfortunately I use Thunderbird and the newsgroup, not the web interface, so I'm not sure how I can enable markdown there. If anybody knows (perhaps adding a header or something?) I would be glad to do it.

Alternatively, wouldn't it make sense to enable it by default so it would apply to all the messages coming from email / the newsgroup?

There isn't an easy way to do it. Vladimir wrote a gist that does it as a proxy server, which I used for a long time. But now with the new update, thunderbird is just completely borked for me, and I don't feel like rebuilding the data, so I'm using the web forum for now.

But in case you want to try it, it is here: https://gist.github.com/CyberShadow/ccb3813d5953e5e7f2c53fe43275f986

-Steve

October 25, 2023

On Monday, 23 October 2023 at 14:44:49 UTC, matheus wrote:

>

On Monday, 23 October 2023 at 14:12:25 UTC, Rumbu wrote:

>

On Saturday, 21 October 2023 at 18:59:13 UTC, Adam D Ruppe wrote:

>

On Saturday, 21 October 2023 at 18:31:10 UTC, Imperatorn wrote:

>

In C# an interpolated string is just a string

This isn't true. It is an object that can convert to string (similar to D's alias toString this;)

In fact neither, it's syntactic sugar.

int count = 10;
string s = $"I drink {count} beers";

is syntactic sugar for:
...

Maybe we're talking about the same thing or it changed, but I thought it was a syntactic sugar for string.format():

https://web.archive.org/web/20160304034509/https://roslyn.codeplex.com/discussions/570614

Matheus.

The above is correct for what Roslyn does. The String.Format stuff comes in when you are trying to format the incoming variable, like so:

string s = $"I drink {count:0000} beers";

Which will produce: "I drink 0010 beers"

October 24, 2023
On 10/23/2023 1:28 AM, Arafel wrote:
> ...

Thank you. The trouble is with the mixin. It can't be dispensed with.
October 24, 2023
On 10/23/2023 5:03 AM, Arafel wrote:
> Unfortunately I use Thunderbird and the newsgroup, not the web interface, so I'm not sure how I can enable markdown there. If anybody knows (perhaps adding a header or something?) I would be glad to do it.


There's a thunderbird extension to do it. I use it. It's called "Render Markdown Messages".
October 25, 2023
On 10/21/2023 2:11 PM, Imperatorn wrote:
> Agreed. We need a better/simpler way to get the string from the expression without special syntax.

```
import std.format;
alias f = std.format.format;

enum b = "betty";
pragma(msg, i"hello $b".f);
```
October 25, 2023
On 25/10/23 8:52, Walter Bright wrote:
> There's a thunderbird extension to do it. I use it. It's called "Render Markdown Messages".

I also use it, but that's only for rendering... it stills sends the messages as plaintext, even if one uses markdown, so the markdown shows unprocessed in the web interface.

Those of us using the extension see them properly rendered, though :-)

Apparently there is a bug for thunderbird about that:

https://bugzilla.mozilla.org/show_bug.cgi?id=1280912

7 years and still no sign of a solution anytime soon...
October 25, 2023
On 25/10/23 8:49, Walter Bright wrote:
> Thank you. The trouble is with the mixin. It can't be dispensed with.

Well, I know you want to make mixins clearly identifiable, but I would suggest some easy sintax for string mixins generated by a template.

For instance, using `!!` (I think it's an unused token):

```d
foo!!(a, 42)
```

would be literally just another way of writing:

```d
mixin(foo!(a,42))
```

and thus anybody could implement:

```d
i!!"Helo ${name}"
```

as a library solution, or even use the existing ones.

You could create mixins that are tighly coupled to the called function, or generic ones... it would be the most flexible solution.
October 25, 2023
On Wednesday, 25 October 2023 at 07:08:06 UTC, Walter Bright wrote:
> On 10/21/2023 2:11 PM, Imperatorn wrote:
>> Agreed. We need a better/simpler way to get the string from the expression without special syntax.
>
> ```
> import std.format;
> alias f = std.format.format;
>
> enum b = "betty";
> pragma(msg, i"hello $b".f);
> ```

I get your point, however, it forces the user to import std.format in the entire codebase wherever a function takes or returns a string and the user wants to use string interpolation
October 25, 2023
On Wednesday, October 25, 2023 2:00:38 AM MDT Arafel via Digitalmars-d wrote:
> On 25/10/23 8:49, Walter Bright wrote:
> > Thank you. The trouble is with the mixin. It can't be dispensed with.
>
> Well, I know you want to make mixins clearly identifiable, but I would suggest some easy sintax for string mixins generated by a template.
>
> For instance, using `!!` (I think it's an unused token):
>
> ```d
> foo!!(a, 42)
> ```
>
> would be literally just another way of writing:
>
> ```d
> mixin(foo!(a,42))
> ```
>
> and thus anybody could implement:
>
> ```d
> i!!"Helo ${name}"
> ```
>
> as a library solution, or even use the existing ones.
>
> You could create mixins that are tighly coupled to the called function, or generic ones... it would be the most flexible solution.

IMHO, mixins should be explicit, obvious, and greppable, and adding a separate syntax for them which tries to hide them is going to make the language worse. However a string is generated, if the programmer wants to turn it into code, they should just use mixin, and if it's ugly, it's ugly, but at least it's clear what's going on.

- Jonathan M Davis



October 25, 2023
On Wednesday, October 25, 2023 3:55:13 AM MDT Imperatorn via Digitalmars-d wrote:
> On Wednesday, 25 October 2023 at 07:08:06 UTC, Walter Bright
>
> wrote:
> > On 10/21/2023 2:11 PM, Imperatorn wrote:
> >> Agreed. We need a better/simpler way to get the string from the expression without special syntax.
> >
> > ```
> > import std.format;
> > alias f = std.format.format;
> >
> > enum b = "betty";
> > pragma(msg, i"hello $b".f);
> > ```
>
> I get your point, however, it forces the user to import std.format in the entire codebase wherever a function takes or returns a string and the user wants to use string interpolation

That's what you have to do now anyway, and all string interpolation really is is a way to do format with variable names thrown in the middle of the string instead of %s.

- Jonathan M Davis