November 13, 2023

On Monday, 13 November 2023 at 02:23:22 UTC, Imperatorn wrote:

>

https://paste.myst.rs/u074ali8

Thank you,Have a nice day!

November 13, 2023

On Monday, 13 November 2023 at 03:07:07 UTC, Mike Parker wrote:
https://gist.github.com/mdparker/f28c9ae64f096cd06db6b987318cc581

> >

I can't access it,please post it here.

I can't. It's too big. That's why I posted it there.

I can't access https://gist.github.com,
Anyway, thank you for your efforts.

November 13, 2023

On Monday, 13 November 2023 at 04:47:42 UTC, matheus wrote:

>

That's it!

Matheus.

Thank you, Matheus.Have a nice day.

November 13, 2023

On Sunday, 12 November 2023 at 19:50:02 UTC, Mike Parker wrote:

>

Well. For the first time in all my years of using these forums, I've managed to post something that exceeds the byte limit. You'll find the September 2023 Monthly Meeting Summary at the following link:

https://gist.github.com/mdparker/f28c9ae64f096cd06db6b987318cc581

Thank you for posting. As always, it's interesting read. And it's great for the community to get the feeling for what's happening.

Nice to see that people such as Adam and Timon joined these discussions recently.

Topic-wise, I would be interested in how the "shared" is going to be shaped. Especially, I remember Manu advocating for a quite simple in principle approach to it, but he never got to much positive vibes from the community. I noticed his suggestions mentioned in the summary notes of the DLF meeting, and wondered whether some of those ideas will be part of the discussion.

November 13, 2023

On Sunday, 12 November 2023 at 21:55:31 UTC, Paul Backus wrote:

>

On Sunday, 12 November 2023 at 19:50:02 UTC, Mike Parker wrote:

>

https://gist.github.com/mdparker/f28c9ae64f096cd06db6b987318cc581

>

There was a side discussion about how the extern(C++) interface affects dmd-as-a-library.

Personally, my number-one complaint with dmd-as-a-library is that I am forced to use extern(C++) when creating my own Visitor classes.

In dmdtags, this requirement has made it necessary for me to implement my own C++-compatible Span and Appender types, just to avoid the C++ mangling errors caused by D's built-in T[] slices.

I have no use for overriding AST nodes, but the ability to use extern(D) visitors with dmd-as-a-library would be a welcome improvement.

I have already brought that up to one of our work group meetings regarding dmd as a library as I have stumbled upon this also. We have a solution for this, I'm going to try to implement it this week.

RazvanN

November 13, 2023

On Monday, 13 November 2023 at 00:18:35 UTC, Richard (Rikki) Andrew Cattermole wrote:

>

Part of the problem with shared is that it is completely inverse of what it should be.

It fundamentally does not annotate memory with anything extra that is useful.

At the CPU level there are no guarantees that memory is mapped only to one thread, nor at the language level.

Therefore all memory is shared between threads.

As long as people have this inverted mindset in place and instead of wanting to prove its thread owned shared is going to be a problem for us.

Remove shared, add atomic storage class. Figure out thread owned/shared memory some other day.

Just to once again add my own view, since I don't see it represented a lot:

Remove shared or don't, at least stop making synchronized imply shared. I don't care about shared, I don't care about atomics, I want to use the mutex style of protecting access, where I manually think about who exclusively owns what memory. But I can't use synchronized, because then I have to cast every access to this, which is clearly insane, and as a result invariant-using class code is straight up incorrect, because I have literally no choice but to do this:

class Foo
{
  private int[] array;

  invariant { synchronized (this) { assert(this.array.all!(i => i > 0)); } }

  void foo(int i)
  in (i > 0)
  {
    synchronized (this)
    {
      // Note that the invariant on `array` is not actually guaranteed here!
      // Some other method in another thread might currently have set up a violation
      // for it, but switched out before its out invariant could be locked and tested.
      // So we can have a *wrong invariant in this method,* which has done absolutely
      // nothing wrong. Very fun!!
      array ~= i;
    }
  }
}

The only way to prevent this is synchronized class, but even if all missing features are implemented, array would be shared. Which is just wrong, as array is privately owned storage of the class, a fact I cannot prove to the compiler but is nonetheless true. synchronized class brings in the one feature I don't want to use and makes it an unavoidable condition of literally writing correct code at all. So yeah shared, I didn't want to be your enemy but apparently you wanted to be mine. shared delenda est.

November 13, 2023
Agreed, getting good locking support is critical for safe memory handling at the process level.

Shared as we know it today, is just a distraction from this goal.
November 13, 2023

On Monday, 13 November 2023 at 10:01:23 UTC, RazvanN wrote:

>

On Sunday, 12 November 2023 at 21:55:31 UTC, Paul Backus wrote:

>

I have no use for overriding AST nodes, but the ability to use extern(D) visitors with dmd-as-a-library would be a welcome improvement.

I have already brought that up to one of our work group meetings regarding dmd as a library as I have stumbled upon this also. We have a solution for this, I'm going to try to implement it this week.

That's great to hear! Thanks for letting me know.

November 13, 2023

On Sunday, 12 November 2023 at 19:50:02 UTC, Mike Parker wrote:

>

https://gist.github.com/mdparker/f28c9ae64f096cd06db6b987318cc581

Thanks for the detailed summary, I'm reading them all!

November 13, 2023

On Sunday, 12 November 2023 at 21:55:31 UTC, Paul Backus wrote:

>

Personally, my number-one complaint with dmd-as-a-library is that I am forced to use extern(C++) when creating my own Visitor classes.

In [dmdtags][1], this requirement has made it necessary for me to implement my own C++-compatible [Span][2] and [Appender][3] types, just to avoid the C++ mangling errors caused by D's built-in T[] slices.

I have no use for overriding AST nodes, but the ability to use extern(D) visitors with dmd-as-a-library would be a welcome improvement.

The visitor can already be extern(D). Only member functions overriding those in the base class need to be extern(C++). Other member functions can then use paratemers, which would be incompatible with extern(C++).