New syntax for comma expression

Nick Treleaven nick at geany.org
Thu Nov 21 17:56:08 UTC 2024


On Thursday, 21 November 2024 at 02:40:15 UTC, Richard (Rikki) 
Andrew Cattermole wrote:
> The comma expression is in the language. But because of tuples 
> its on the way out and so it doesn't support everything that it 
> needs to.

When we have tuples: `(e1, e2, e3)[$-1]` instead of `(e1, e2, 
e3)` in C.

> Regardless the .di generator is broken for D code. That means 
> errors are not emitting correct code either. This affects a lot 
> more than just a couple of switches.
>
> A simple parser change that won't break code and which has the 
> chance to fix some hard problems should be an easy win.
>
> If you think this can be fixed another way, please prove me 
> wrong. I'd love for the .di generator to be functional 
> regardless of who or what approach is taken to achieve it.

Maybe:
```d
(){
	class __anonclass1 : BaseClassList
	{
		void* this;
	}
	return new __anonclass1 args; }()
```
Could that work correctly with the context pointer?

Otherwise to generally fix it, there would need to be a way of 
declaring inline types in an expression. (We also might want 
inline template syntax).


More information about the dip.ideas mailing list