On Friday, 10 January 2025 at 16:57:10 UTC, An wrote:
If the compiler flags this as an warning -> he probably notice
the problem
Lag of error/warn/hint for such case is not helping
Happy coding
I'm trying out making it an error:
https://github.com/dlang/dmd/pull/20696
On 1/12/25 8:55 PM, H. S. Teoh wrote:
> I wish there was some kind of syntactic sugar for assigning ctor
> parameters to class members.
Amen. Dart provides some help. It's under Generative Constructors here:
https://dart.dev/language/constructors
class Point {
// Instance variables to hold
On Thursday, 9 January 2025 at 23:44:52 UTC, WhatMeWorry wrote:
You misspelled the parameter name 'locaction', so your
assignment in the constructor is a no-op:
```
this.location = this.location
```
Thanks. I was starting to question my sanity.
That error is so classic that eventually a we
On Mon, Jan 13, 2025 at 04:05:25AM +, Jim Balter via Digitalmars-d-learn
wrote:
> On Thursday, 9 January 2025 at 22:08:31 UTC, Dennis wrote:
> > On Thursday, 9 January 2025 at 22:01:59 UTC, WhatMeWorry wrote:
> > > this(Location locaction, uint f) {
> > > this.location = location;
On Thursday, 9 January 2025 at 22:08:31 UTC, Dennis wrote:
On Thursday, 9 January 2025 at 22:01:59 UTC, WhatMeWorry wrote:
this(Location locaction, uint f) {
this.location = location;
this.f = f;
}
You misspelled the parameter name 'locaction', so your
assignment in t
On Thursday, 9 January 2025 at 22:08:31 UTC, Dennis wrote:
On Thursday, 9 January 2025 at 22:01:59 UTC, WhatMeWorry wrote:
this(Location locaction, uint f) {
this.location = location;
this.f = f;
}
You misspelled the parameter name 'locaction', so your
assignment in t
struct Node
{
uint multiplier;
Location location;
this(Location locaction, uint multiplier)
{
this.location = location * multiplier;
this.multiplier = multiplier;
}
}
I appreciate your example of the robustness of D, but if I was to
make the same syntax mistake:
this(Loca
On Thursday, 9 January 2025 at 22:01:59 UTC, WhatMeWorry wrote:
produces:
n = Node(Location(0, 0), 33)
when I expected
n = Node(Location(1, 2), 33)
This is a simple typo (it shouldn't be 1 letter) but the code
should be made smarter thanks to the capabilities of D. No more
fear of writing lik
You misspelled the parameter name 'locaction', so your
assignment in the constructor is a no-op:
```
this.location = this.location
```
Thanks. I was starting to question my sanity.
On Thursday, 9 January 2025 at 22:01:59 UTC, WhatMeWorry wrote:
this(Location locaction, uint f) {
this.location = location;
this.f = f;
}
You misspelled the parameter name 'locaction', so your assignment
in the constructor is a no-op:
```
this.location = this.locati
10 matches
Mail list logo