On Friday, 15 September 2023 at 21:49:17 UTC, ryuukk_ wrote:
On Friday, 15 September 2023 at 17:39:41 UTC, M.M. wrote:
In February there were some exciting news on the usage of
dlang within serpent-os linux distribution, quite a large open
source project of Ikey Doherty and the team around him.
Unfortunately, the project decided to leave dlang behind, and
to embrace golang and rust instead... in part due to some
hiccups in dlang and due to contributors pushing for more
mainstream languages:
https://serpentos.com/blog/2023/09/06/oxidised-moss/
Pity that it did not succeed. It would be a great showcase for
the marvelous dlang.
That's unfortunate..
Ikey seems to still want to use D, so the main driving factor
is the contributors, i wonder what are the exact reasons,
pseudo memory safety can't be the only reason
To be honest, I wouldn't blame contributors for looking at more
mainstream languages, who still want to do their switch cases
this way:
```D
switch (it)
{
case MySuperLongEnum.MySuperLongValueA:
result = do_something_a();
break;
case MySuperLongEnum.MySuperLongValueB:
result = do_something_b();
break;
case MySuperLongEnum.MySuperLongValueC:
result = do_something_c();
break;
}
```
When other languages have it cleaner:
```D
result = switch (it)
{
.MySuperLongValueA: do_something_a();
.MySuperLongValueB: do_something_b();
.MySuperLongValueC: do_something_c();
}
```
Improving ergonomics won't necessarily attract people, probably
not, but i'm pretty sure that'll make contributors of existing
projects not request to change language because the ergonomics
are so poor
Even C# understand that and made the appropriate changes across
their language and even improve their compiler to avoid the
urge to switch to Go (NativeAOT), even Java made appropriate
language changes in hope to stay relevant, why only D should be
frozen? Acting like the world depend on D
D has many benefits, but some areas need lot of love, this
reminds me of this dude in an online chat, he said the reason
why he stick to Rust was because of Rust's enum.. not because
of memory safety
Hopefully more wake up calls like this one will resonate with
the D foundation
I do not think the lack of a little bit of syntax sugar is what
is hurting D.
Also `with` is your friend.
```D
auto result = (){with(MySuperLongEnum) final switch(it){
case MySuperLongValueA: return do_something_a();
case MySuperLongValueB: return do_something_b();
case MySuperLongValueC: return do_something_c();
}}();
```
full version that will compile, if you want to play with this.
```D
@safe:
enum MySuperLongEnum{
MySuperLongValueA,
MySuperLongValueB,
MySuperLongValueC,
}
int do_something_a(){ return 1; }
int do_something_b(){ return 42; }
int do_something_c(){ return 99; }
void main(){
auto it = MySuperLongEnum.MySuperLongValueB;
auto result = (){with(MySuperLongEnum) final switch(it){
case MySuperLongValueA: return do_something_a();
case MySuperLongValueB: return do_something_b();
case MySuperLongValueC: return do_something_c();
}}();
import std.stdio;
writeln("result: ", result);
}
```