Which language futures make D overcompicated?
Seb
seb at wilzba.ch
Fri Feb 9 18:34:33 UTC 2018
On Friday, 9 February 2018 at 18:21:55 UTC, Bo wrote:
> Here are a few more "basics" that are unneeded or confusing.
> Lets not even talk about the more advanced features like inout,
> ...
>
> /-/
>
> * auto: Static typed language yet we fall back on the compiler
> to figure out what is being assigned. Can just as well have a
> interpreter language. It only encourages lazy writing and has a
> penalty on the compilation.
There's almost zero/no penalty on the compilation cost.
What's wrong with letting the compiler help you?
If you don't like auto, simply don't use it :O
> /-/
>
> * to!string, to!... requires "import std.conv"
> * basic string manipulation requires "import std.string"
> * join, replace, replaceInPlace, split, empty all require
> std.array
> * ...
>
> ... these are basic language features, yet its required to
> included each of those libraries to every file you need it. A
> lot of languages have basic functions as standard or
> dynamically include the required code upon compilation ( or
> error if you have a double naming ). The time saved on auto
> compilation, can be reused to do the above mentioned. Two birds
> with one move.
We're getting there: https://github.com/dlang/phobos/pull/5916
> /-/
>
> * splitLines vs split .. std.array vs std.string
>
> It confuses people because split is part of std.array but
> splitLines is part of std.string. Really! Most languages simply
> have split as a basic language feature and you indicate what
> you want to split.
>
> Its not the only confusing or double function that is present
> in the standard library.
I assume you aren't aware of the superior splitter in
std.algorithm?
tl;dr: split has been there before, but it's: `splitter.array`
However, we can't remove these things without breaking code.
We can only improve the documentation and tutorials, to which you
are more than cordially invited.
> /-/
>
> * scope() .. just call it "defer" just as every other language
> now does. It only confuses people who come from other
> languages. Its now almost a standard. By using scope people
> have have no clue that D has a defer. Took even me a while to
> know that D had a defer system in place.
1) I only know about defer in Go. That's not a standard.
2) How do you do scope(failure) in Go?
Scope solves multiple uses with one nice keyword.
After all, the "thing" you are leaving is called scope.
> /-/
>
> If you have a few more weeks, this list is long :)
Please put any fixable issues / actionable ideas on Bugzilla.
Thanks!
> Unfortunately, because the code base it is impossible to fix
> these issues as too much code depends on it. The libraries,
> packages, ...
Yes, but it looks like all these issues can be fixed / improved
with better documentation
For example, for scope:
https://tour.dlang.org/tour/en/gems/scope-guards
If you don't like it, please improve it!
More information about the Digitalmars-d
mailing list