Thread overview | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
October 18, 2017 My two cents | ||||
---|---|---|---|---|
| ||||
Hi, I had been using D for almost 6 years and I want to share my opinion with you. I don't want to blame anyone but I'll focus more on bad things and possible improvements. And this is just how I see D from my perspective. (Sorry for my English, I'm too lazy to take the lessons). First, D started as a great new language with the best from all languages. But now D seems more and more conservative. New syntactic sugars aren't added just because they can be found in phobos. (this was Walter's answer when I asked for maybe monad syntactic sugar). OK, what I'm missing in D and what I think is wrong? syntactic sugar for: tuples maybe monad (why we cannot have same syntax as in C#?) conditional dereferencing and stuff about that (same as in C#) foo?.bar; foo?[bar]; return foo ?? null; async/await (vibe.d is nice but useless in comparison to C# or js async/await idiom) I want to create function returning Promise/Task and await where I want to. e.g. auto result = device.start(foo, bar); // This is RPC to remote server returning Task!Bar // do some important stuff return await result; // wait for RPC finish, then return it's result I want to do this and not any ugly workaround about that. @trusted, @safe, @system - why we have 3 keywords instead of one? And why it's so complicated to use? First, we should have one 'unsafe' keyword. Second, everything should be safe by default. 3rd, if we want to declare @system func, use 'void foo() unsafe;' if we want to declare @trusted func, use void foo() { unsafe { } } This fulfills the D's idiom in better way, because we should be defining unsafe sections as small as possible. C# properties instead of existing ones. function and property should be two different things. Calling function without () or assigning to it by = is a ugly behavior and should be avoided. implement this thing from C# (just because it's cool) new Foo() { property1 = 42, property2 = "bar" }; Reference counting when we cannot use GC... Commercial usage, shared libraries and stuff There isn't any handy tool to download, manage and publish closed source stuff. dub is great for simple solutions but useless in big projects with multiple targets, configurations, etc. Everything is primary focused on opensource development (but everyone here wants to see D as a next successor of C++ in commercial sphere). Still cannot easily develop closed source dlls on Windows. On Linux every symbol is public by default, but on Windows not so it's needed to export them manually. Unable to publish closed source library without workaround and ugly PIMPL design. Add dll/so usage without header files (export enums, templates and stuff right into dll/so and let D compiler to import these stuff from it) For me, it seems like Walter is solving edge case problems like return ref parameters and return functions but is unable to add some basic stuff. Thanks for your time. - Satoshi |
October 18, 2017 Re: My two cents | ||||
---|---|---|---|---|
| ||||
Posted in reply to Satoshi | I think you missed many things for example: On Wednesday, 18 October 2017 at 08:56:21 UTC, Satoshi wrote: > e.g. > auto result = device.start(foo, bar); // This is RPC to remote server returning Task!Bar > // do some important stuff > return await result; // wait for RPC finish, then return it's result https://dlang.org/phobos/std_parallelism.html#.task |
October 18, 2017 Re: My two cents | ||||
---|---|---|---|---|
| ||||
Posted in reply to Satoshi | +syntactic sugar for dynamic types some better explaining tutorials and examples about shared. After 6 years I'm still unable to use it properly. |
October 18, 2017 Re: My two cents | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrea Fontana | On Wednesday, 18 October 2017 at 09:03:27 UTC, Andrea Fontana wrote:
> I think you missed many things for example:
>
> On Wednesday, 18 October 2017 at 08:56:21 UTC, Satoshi wrote:
>
>> e.g.
>> auto result = device.start(foo, bar); // This is RPC to remote server returning Task!Bar
>> // do some important stuff
>> return await result; // wait for RPC finish, then return it's result
>
> https://dlang.org/phobos/std_parallelism.html#.task
Sorry, I mean Task from C# which is returned from async func, not the D's Task.
|
October 18, 2017 Re: My two cents | ||||
---|---|---|---|---|
| ||||
Posted in reply to Satoshi | On Wednesday, 18 October 2017 at 08:56:21 UTC, Satoshi wrote:
> For me, it seems like Walter is solving edge case problems like return ref parameters and return functions but is unable to add some basic stuff.
>
>
> Thanks for your time.
> - Satoshi
well, i've been following this forum for a while now
and i remember seeing posts by either Walter or Andrei Alexandrescu, saying something in the sense
that D, has become too big, and is not being used to its full potential
i.e. the usage of the existing features is not being exploited to their maximum potential
and they were sort of hoping, the user community will start to develop "idioms" around what exist already
instead of adding more features
i am not sure how much of what you use can be fulfilled with "idioms"
and i think Walter's or Andrei's intention seems fair
but then again, i agree with you, it is hard to push for idioms as the expense of conveniance features
when you dont have the user mass yet
unfortunately D probably need to keep adding features, until it find its mass
|
October 18, 2017 Re: My two cents | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ali | On Wednesday, 18 October 2017 at 16:45:33 UTC, Ali wrote:
> On Wednesday, 18 October 2017 at 08:56:21 UTC, Satoshi wrote:
>> [...]
>
> well, i've been following this forum for a while now
> and i remember seeing posts by either Walter or Andrei Alexandrescu, saying something in the sense
> that D, has become too big, and is not being used to its full potential
> i.e. the usage of the existing features is not being exploited to their maximum potential
>
> [...]
The language itself has too many that we can't even use 50%.
|
October 19, 2017 Re: My two cents | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ali | On Wednesday, 18 October 2017 at 16:45:33 UTC, Ali wrote:
> On Wednesday, 18 October 2017 at 08:56:21 UTC, Satoshi wrote:
>> For me, it seems like Walter is solving edge case problems like return ref parameters and return functions but is unable to add some basic stuff.
>>
>>
>> Thanks for your time.
>> - Satoshi
>
> well, i've been following this forum for a while now
> and i remember seeing posts by either Walter or Andrei Alexandrescu, saying something in the sense
> that D, has become too big, and is not being used to its full potential
> i.e. the usage of the existing features is not being exploited to their maximum potential
>
> and they were sort of hoping, the user community will start to develop "idioms" around what exist already
> instead of adding more features
>
> i am not sure how much of what you use can be fulfilled with "idioms"
> and i think Walter's or Andrei's intention seems fair
>
> but then again, i agree with you, it is hard to push for idioms as the expense of conveniance features
> when you dont have the user mass yet
>
> unfortunately D probably need to keep adding features, until it find its mass
I agree with what is being said.
For example async is totally doable with the current level of control that D gives you.
The problem in my opinion is the ecosystem.
We miss a build system that is tailored towards enterprises and there is so much work to do with libraries (even discovery of them) and documentation by examples.
|
October 19, 2017 Re: My two cents | ||||
---|---|---|---|---|
| ||||
Posted in reply to Fra Mecca | On 10/18/17 23:50, Fra Mecca wrote: [snip] > The problem in my opinion is the ecosystem. > We miss a build system that is tailored towards enterprises and there is > so much work to do with libraries (even discovery of them) and > documentation by examples. Indeed ... :) -- Adam Wilson IRC: LightBender import quiet.dlang.dev; |
October 20, 2017 Re: My two cents | ||||
---|---|---|---|---|
| ||||
Posted in reply to Satoshi | On Wednesday, 18 October 2017 at 08:56:21 UTC, Satoshi wrote: > conditional dereferencing and stuff about that (same as in C#) > foo?.bar; > foo?[bar]; > return foo ?? null; Tbh. these are some I really wish were in D, because it becomes tedious having to write something like this all the time: return foo ? foo : null; where return foo ?? null; would be so much easier. It especially becomes painful when you have something with multiple member accesses. Like: return foo ? foo.bar ? foo.bar.baz ? foo.bar.baz.something : null; Which could just be: return foo?.bar?.baz?.something; > > async/await (vibe.d is nice but useless in comparison to C# or js async/await idiom) > I want to create function returning Promise/Task and await where I want to. > e.g. > auto result = device.start(foo, bar); // This is RPC to remote server returning Task!Bar > // do some important stuff > return await result; // wait for RPC finish, then return it's result I don't think this is much necessary, because the fiber implementations already are able to let you write code close to this. The only difference is you have to import the modules, but it's such a small thing I don't think you really need this. > > implement this thing from C# (just because it's cool) > new Foo() { > property1 = 42, > property2 = "bar" > }; > > > > Thanks for your time. > - Satoshi I really wish this was implemented for classes too! Currently it exist for structs and it completely baffles me why it has never been implemented for structs. |
October 20, 2017 Re: My two cents | ||||
---|---|---|---|---|
| ||||
Posted in reply to bauss | On Friday, 20 October 2017 at 00:26:19 UTC, bauss wrote: > return foo ? foo : null; > > where > > return foo ?? null; would be so much easier. return getOr(foo, null); That's really easy to do generically with a function. I wouldn't object to the ?? syntax, but if it really is something you write all over the place, you could just write the function. > return foo ? foo.bar ? foo.bar.baz ? foo.bar.baz.something : null; > > Which could just be: > > return foo?.bar?.baz?.something; In dom.d, since I use this kind of thing somewhat frequently, I wrote a function called `optionSelector` which returns a wrapper type that is never null on the outside, but propagates null through the members. So you can do foo.optionSelector("x").whatever.you.want.all.the.way.down and it handles null automatically. You can do that semi-generically too with a function if it is something you use really frequently. |
Copyright © 1999-2021 by the D Language Foundation