January 06
On 1/2/2025 1:14 PM, ryuukk_ wrote:
> that's hard to learn, why is it possible to do `outter.b = 42`?

Anonymous structs/unions aren't actually structs/unions in D at all. They only control layout. This characteristic is quite useful, C11 added it.
January 06

On Sunday, 5 January 2025 at 07:48:38 UTC, ryuukk_ wrote:

> >

Why do you need an anonymous struct type there? Naming it and using the struct name for inner isn't difficult, and it doesn't seem needed that often.

It's same story with tagged union, tuples, .enum, if you don't see them as improvements, there is nothing to argue about, try to use a language that supports them all, and you'll realize that it's like stepping up and upgrading your toolbox

You were asking for anonymous structs, yet tuple syntax is already planned (and std Tuple is usable today). It's not good design to have both in the language. If a tuple is too concise for a use-case (e.g. you want to ddoc the fields), then use a named struct.

Too much language complexity has costs in tooling, learning, error messages, etc.

January 07

On Monday, 6 January 2025 at 12:12:30 UTC, Nick Treleaven wrote:

>

On Sunday, 5 January 2025 at 07:48:38 UTC, ryuukk_ wrote:

> >

Why do you need an anonymous struct type there? Naming it and using the struct name for inner isn't difficult, and it doesn't seem needed that often.

It's same story with tagged union, tuples, .enum, if you don't see them as improvements, there is nothing to argue about, try to use a language that supports them all, and you'll realize that it's like stepping up and upgrading your toolbox

You were asking for anonymous structs, yet tuple syntax is already planned (and std Tuple is usable today). It's not good design to have both in the language. If a tuple is too concise for a use-case (e.g. you want to ddoc the fields), then use a named struct.

Too much language complexity has costs in tooling, learning, error messages, etc.

there is none of that in the language Today, if listening to you, then let's stop all the DIPs and discussions about improving the language

i think there is a bias coming from you here, you don't see any of that as an improvement for Yourself, therefore you turn them down automatically without any valid arguments

and by valid i meant something that is not "it adds code to DMD"

besides, i'm not asking for any new feature here, just an improvement to anonymous struct, wich is already an existing concept in D

if i were to ask for @safe, sure, @super_safe, sure sure, placement new? obviously, new feature, but i am not

so let's discuss, on the merit of trying to improve things and make them nicer to use, using critical thinking, and by avoiding personal bias

Spring is next, let's dust the elephant, editions are coming.. better prepare, or, it's gonna "add too much code to DMD"?

January 07

The main issue with a C style anonymous struct and definition

struct outer {
   struct {
      int a;
   } instance;
}

Would be the grammar point previously mentioned, making the above incompatible, due to structs within structs not requiring terminating semi-colons.

Changing that in general would be too big a breaking change to be viable.

Depending upon how much use is currently made of D style 'anonymous structs', the one possibility I could see is changing the grammar to require such to have a trailing semi-colon. This is also a breaking change, but possibly it would be viable if the current D style anonymous structs are not commonly used.

However at this stage, I'd be inclined just to say forget about it.

The C style can be handled by ImportC, albeit any .di file generated by such can not express the concept.

So if one wishes to have this form used, one simply needs to have mixed C and D program.

January 08
On Sun, 29 Dec 2024 at 06:11, Max Samukha via Digitalmars-d < digitalmars-d@puremagic.com> wrote:

> On Saturday, 28 December 2024 at 19:21:43 UTC, Walter Bright wrote:
>
> >
> > Manu suggested this.
>
> People discussed this for ages.
>

Yes, this issue is indeed ancient news; and I'm glad we have a fix. There are more like this.


January 08

On Tuesday, 7 January 2025 at 10:10:19 UTC, Derek Fawcus wrote:

>

The main issue with a C style anonymous struct and definition

struct outer {
   struct {
      int a;
   } instance;
}

Would be the grammar point previously mentioned, making the above incompatible, due to structs within structs not requiring terminating semi-colons.

Changing that in general would be too big a breaking change to be viable.

Depending upon how much use is currently made of D style 'anonymous structs', the one possibility I could see is changing the grammar to require such to have a trailing semi-colon. This is also a breaking change, but possibly it would be viable if the current D style anonymous structs are not commonly used.

However at this stage, I'd be inclined just to say forget about it.

The C style can be handled by ImportC, albeit any .di file generated by such can not express the concept.

So if one wishes to have this form used, one simply needs to have mixed C and D program.

https://github.com/dlang/dmd/pull/20653

D++ gets a free pass

January 08

On Wednesday, 8 January 2025 at 08:13:58 UTC, ryuukk_ wrote:

>

https://github.com/dlang/dmd/pull/20653

D++ gets a free pass

The point would seem to be that the change does not break, nor change the meaning of, any previously functional code.

Anyway, I'd actually characterise this as a subset of Algol 68 style, which Go (and I guess C++) just happen to support.

BEGIN
	INT a = 2;

	IF INT b = a OVER 2; print(b); a > 1 THEN
		print((newline, "a > 1", newline))
	FI;
	print(newline)
END
$ a68g conditional.a68
         +1
a > 1

1 2 3 4 5
Next ›   Last »