does D already have too many language features ?

Alex AJ at gmail.com
Tue Apr 9 14:42:47 UTC 2019


On Monday, 8 April 2019 at 22:15:52 UTC, Julian wrote:
> On Monday, 8 April 2019 at 21:52:37 UTC, Alex wrote:
>> Personally, I might suggest you go learn Haskell.
>
> I would interpret this as a request to take a long walk on a 
> short pier.
> It probably depends on the receiver's feelings for Haskell.
>
lol, ok. Well. Again, one can't make an informed decision about 
something without being informed. Even if one doesn't like 
something they can learn from it.

People are so controlling of their time that they do more harm 
than good. Much of what Haskell does is the same as what D does. 
Haskell does typing far better(since it is formally based off of 
category theory and so deals with higher levels of typing that D 
doesn't even come close to). Haskell has it's own problems of 
course... but how do you know this stuff if you don't use it?

>> Or better, you could learn both. Every language will have it's 
>> pro's and con's. Language features are never a con.
>
> Some examples of cons:
>
> - Perl's Java-style new. Never used in favor of ->new(), but 
> since it's
> in the language we have this top-voted SO question:
>
> https://stackoverflow.com/questions/11695110/why-is-this-program-valid-i-was-trying-to-create-a-syntax-error
>
> - Perl's single-quote "dot syntax". Never used in favor of ::, 
> but since it's
> in the language you have to escape single quotes in cases like 
> "$who's"
> so that doesn't look like an invocation of an 's' method.
>
> - Perl's @ interpolation of arrays into strings. Almost never 
> used
> deliberately, but since it's in the language you have to escape 
> email
> addresses in strings.
>
> - Perl's scalar/list context system. It's super cute, and it 
> also means
> that blah("hi") either returns "hi" or "ih" ... depending on 
> the call.
>
>   sub blah {
>     my $x = shift;
>     reverse($x)
>   }
>
> It's not all Perl, but the more common 'con' is a feature that 
> opens
> a window while closing a hallway of doors for a language's 
> future
> development.


These are not language features but language design choices. 
There is a huge difference.

The only con to a language feature is that if one person doesn't 
like it and reads someone else's code that does then they will 
not like the code.

Again, if you have the option not to use it then you are not 
forced to use it(except he case just cited). The only language 
feature that is bad is the language feature you want but don't 
have.

Language features are independent of grammatical 
construction/syntax. (any syntax can be given to a language 
feature to do something, it doesn't change what the language 
feature is, which is an abstract pattern to simplify work)

Remember, Language features add something on top of something 
else. If they take something else away in the process they are 
not language features. They are not providing an option but a 
mutation.

This is how language features work:

class LanguageFeature : Language


in essence, meaning that one can always use the base "class" to 
do their work in. It it doesn't work this way then it is not a 
feature. [Of course, it is true that in implementation of the 
feature it can cause problems, but that is not a problem of the 
feature itself but the implementation]





More information about the Digitalmars-d mailing list