[Dlang-internal] Some suggestions for the d language
Shadowblitz16
DomainName at Email.com
Thu Sep 19 18:39:42 UTC 2019
On Thursday, 19 September 2019 at 05:05:51 UTC, Max Haughton
wrote:
> On Wednesday, 18 September 2019 at 21:03:36 UTC, Shadowblitz16
> wrote:
>> I had some suggestions for the d language that I think would
>> improve it a bunch.
>>
>> 1. var keyword for autodetect of auto and mixin.
>> this is just a optional way of typing auto and mixin.
>> automatically detects which one.
>>
>> 2. optional use of <> instead of !() and (). for templates.
>> coming from the C# language it's my opinion it's easier to
>> type and is more readable.
>>
>> 3. coroutines (aka async functions) and yield overloads
>> being able to execute functions and yield from them...
>>
>> bool coroutine(bool done)
>> {
>> yield(false );
>> yield(false, 3); //yields for 3 seconds (double)
>> yield(false, done); //yields until done is true (bool)
>> return true;
>> }
> 1. Why?
>
> 2. No, the reason why D uses ! Instead of <> is to make the
> compiler saner to implement.
>
> 3. Fibers are available in the standard library, which
> implement coroutines
1. var is easier to type and would be basically a universal type.
2. right now is confusing to use.
it might be harder to implement, but it makes code cleaner and
more readable.
3. I would rather not have to call a function for coroutines to
create them.
its alot easier to just yield out of a function. of course if
this slows the language down it would be bad.
I think the language should auto detect if a yield is used and
execute and store a coroutine until it is finished.
More information about the Dlang-internal
mailing list