Which language futures make D overcompicated?

H. S. Teoh hsteoh at quickfur.ath.cx
Fri Feb 9 18:31:18 UTC 2018


On Fri, Feb 09, 2018 at 05:56:38PM +0000, Dukc via Digitalmars-d wrote:
> On Friday, 9 February 2018 at 07:54:49 UTC, Suliman wrote:
> > Which language futures by your opinion make D harder?
> 
> Not many! D is a fairly complex languague, but just about everything
> feels like to be here for a good reason. That includes many oft-hated
> things: inout, auto ref, goto, BetterC...

TBH, I'm not a fan of inout. Not because of how most people feel, that
we shouldn't have it; IMO it doesn't go *far enough*.  For example,
there's currently no way to express conveying the constness of a
delegate argument's parameter to the return value, which would have been
useful in some places in generic code.


> What I would like to remove, is auto-decoding (popular opinion, I
> know)

I would totally back up killing auto-decoding. With fire. And extreme
prejudice. :-P

Unfortunately, that would also cause massive breakage of existing code,
and worse yet, in some cases it will cause *silent* breakage, which is
the worst of its kind.  So barring some kind of workable (probably very
long) deprecation cycle, I just don't see it going away anytime in the
foreseeable future.


> and the heavy syntax when handling types: __traits, is expression,
> typeof and std.meta templates should be invokable in a more UFCS-like
> manner (But still avoiding context-dependant parsing, perhaps with a
> keyword before an expression used as a type in a declaration).

AFAIK, __traits was never intended to be used directly in user code. The
intention was to expose a raw interface into compiler internals, and
then write nicer wrappers in Phobos that provide a more user-friendly
API to users.

As for is-expressions, I think either Walter or Andrei (possibly both)
have acknowledged that the syntax is a mess.  But too much code already
depends on the current syntax, and changing that now will be far too
disruptive.

As for UFCS-style template parameters, I would totally support that!!
I've felt the need for it on more than one occasion.  Perhaps somebody
could write up a DIP for a `.!` operator (tentative syntax) to
complement the current `!` operator.  So you could write things like:

	AliasSeq!(1, 2, 3).!staticMap!(MyPredicate).!staticSort


T

-- 
I am a consultant. My job is to make your job redundant. -- Mr Tom


More information about the Digitalmars-d mailing list