Issue 24726 - Make alias work properly
Summary: Make alias work properly
Status: NEW
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P1 critical
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-08-28 08:01 UTC by Manu
Modified: 2024-08-28 11:34 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Manu 2024-08-28 08:01:45 UTC
There were a bunch of bugs related to alias failing in various cases, and all the bugs have been closed now, along with a message saying "now there's an error message"... and like, wtaf?

This isn't fixed; now there's just a formal recognition that it's broken.
I mean, they say that acknowledgement is the first step to recovery, so hopefully we can move forward. This issue shall stay until it works...

----------------------------

struct S
{
  int x;
}

S instance;

alias xa = instance.x;

----------------------------

alias m = __traits(getMember, instance, member);

----------------------------

alias a = myStruct.tupleof;
alias x = a[0];

----------------------------

...there are countless permutations.

This is a major chasm right in the middle of D's biggest strength and selling point. It's been well understood and people begging to have this resolved for literally decades (plural).

Fix this, don't just close the issues.
Comment 1 anonymous4 2024-08-28 11:19:43 UTC
Maybe something like this?

---
S instance;

lazy xa = instance.x;
---
Comment 2 Nick Treleaven 2024-08-28 11:34:59 UTC
> all the bugs have been closed now,

They are (mostly) still open.

> along with a message saying "now there's an error message"

Those messages were just for information.

> alias xa = instance.x;

Issue 6842 (which is an enhancement).

> alias m = __traits(getMember, instance, member);

See issue 24720.

> alias a = myStruct.tupleof;
> alias x = a[0];

Issue 24717.

> This is a major chasm right in the middle of D's biggest strength and selling point

The only bug which doesn't match the concepts is issue 24717 (and that's if people accept my analysis of it). Possibly the docs could be clearer.

Can we close this issue now? Alternatively you could add other bugs to the 'Depends on' field to make this a meta-bug if you think that's better.