October 14, 2021

On Monday, 11 October 2021 at 21:41:45 UTC, monkyyy wrote:

> >
  • Worst features implemented in a non-toy language
  • Embedding js in an html document.

  • adding objects to an existing language

>
  • Worst features (in your opinion) in D
  • nontrivial namespace collisions when importing std

  • int promotion

  • verbose enums

  • contracts and all the cute ideas expanding a template header to affect the matching

  • sword of damocles of safe by default or who knows what koolaid being enabled one day

Interesting. What is it about safe by default that would worry you?

October 14, 2021

On Thursday, 14 October 2021 at 16:48:12 UTC, Atila Neves wrote:

>

On Monday, 11 October 2021 at 21:41:45 UTC, monkyyy wrote:

>
  • sword of damocles of safe by default or who knows what koolaid being enabled one day

Interesting. What is it about safe by default that would worry you?

I've interacted with monkyyy a bunch in the community Discord. He's the kind of programmer who would rather write code with undefined behavior and get away with it than follow any kind of compiler-enforced rules.

Most programmers with this attitude eventually get it beaten out of them by painful experience. I wouldn't put too much stock in it.

October 14, 2021

On Thursday, 14 October 2021 at 17:02:49 UTC, Paul Backus wrote:

>

On Thursday, 14 October 2021 at 16:48:12 UTC, Atila Neves wrote:

>

On Monday, 11 October 2021 at 21:41:45 UTC, monkyyy wrote:

>
  • sword of damocles of safe by default or who knows what koolaid being enabled one day

Interesting. What is it about safe by default that would worry you?

I've interacted with monkyyy a bunch in the community Discord. He's the kind of programmer who would rather write code with undefined behavior and get away with it than follow any kind of compiler-enforced rules.

Most programmers with this attitude eventually get it beaten out of them by painful experience. I wouldn't put too much stock in it.

The emphasis there should be on "sword of damocles" (uncertainty wrt. a future negative outcome) and "being enabled one day" (a change in the language).

d is currently @system by default, and making it @safe by default is a breaking change that requires people to run through their code and change it, even if just to add a @system: at the top. If you personally greatly value a breaking change then maybe you won't mind this kind of maintenance, but others it's imposed bitrot.

dub could be in the position of automatically trying --revert= flags if the latest tag release is older than some breaking change to dmd

October 14, 2021

On Monday, 11 October 2021 at 15:59:10 UTC, Atila Neves wrote:

>
  • Worst features implemented in a non-toy language

This is not a feature but a language design question. One of the worst thins you can ever do to language is to mix language paradigms. This totally messes up the language as well as your brain.

One of example is C++ template programming which is based on ML. Lately in newer C++ they have tried to taint that mistake up by adding static if and and other things. However, this hasn't completely removed the difficulties with C++ templates and they have added so many things that you might end up even more confused.

You would think that C++ was the last making that mistake but no, Rust did it again. Rust decided to include macro_rules which uses a declarative syntax. Just as in C++ this totally messes up the readability and your way of thinking. Later on Rust realized the mistake and added function macros as well.

Do not make computer languages schizophrenic by mixing programming paradigms.

October 15, 2021

On Thursday, 14 October 2021 at 18:55:53 UTC, IGotD- wrote:

>

On Monday, 11 October 2021 at 15:59:10 UTC, Atila Neves wrote:

>
  • Worst features implemented in a non-toy language

This is not a feature but a language design question. One of the worst thins you can ever do to language is to mix language paradigms. This totally messes up the language as well as your brain.

One of example is C++ template programming which is based on ML. Lately in newer C++ they have tried to taint that mistake up by adding static if

they added if constexpr not static if, which is another thing to add to the list of worst features implemented. The critical difference is that if constexpr always adds a scope whereas static if doesn't. Adding a scope if you need it costs you {}. This prevents if constexpr from being able to conditionally declare declarations (variables, members, members functions etc.)

October 15, 2021

On Friday, 15 October 2021 at 03:38:56 UTC, Nicholas Wilson wrote:

>

they added if constexpr not static if, which is another thing to add to the list of worst features implemented. The critical difference is that if constexpr always adds a scope whereas static if doesn't. Adding a scope if you need it costs you {}. This prevents if constexpr from being able to conditionally declare declarations (variables, members, members functions etc.)

Actually that avoids many tricky problems in the compiler implementation.
When an inline metaprogram can add declarations that requires the compiler to have support for deferred and partial symbol resolution.

At least if you want it work consistently. Static if, works in most cases that I've seen it used... But then again a case that didn't work wouldn't end up in production code so it's hard to tell. When you start playing around with it a bit you'll find it can have very bizarre behavior.

October 15, 2021

On Monday, 11 October 2021 at 15:59:10 UTC, Atila Neves wrote:

>

I'm brainstorming about what I'll talk about at DConf, and during a conversation with Walter I thought it might be cool to talk about:

  • Worst features implemented in a non-toy language
  • Worst features (in your opinion) in D
  • Features you'd like to see in D

Ideas? Examples?

Thanks!

About Wrong D features:

In my opinion, D is afraid of embracing decisions with all it's consequences... it maintains itself in a position where nothing is "the best for niche X"

i.e.: UFCS has not been really embraced with all it's consequences

D doesn't allow this

"hello".(s){
  s.writeln;
}

Of course, you can introduce a template like auto doWith(alias f,T)(T v)=>f(v) or use the "pipe!" template:

"hello".doWith!((s){
  s.writeln;
})

But then yo find you can't do this

void x(string s){
  s.writeln;
}
"hello".x;

i.e.: The "Nullable" allien!!!

D has a complete functional library based on ranges

But then, you find an alien named "Nullable" that is not the equivalent to Optional/Some/None and has not the range capabilities (map, fold, ...).

How difficult will be to embrace the Optional/Some/None pattern in phobos?

D needs to assume it's responsibility standardizing this kind of decisions giving a solid base to other "high level" libraries like database ones (i.e.: managing nullable fields in a "functional" way using the Optional pattern).

i.e.: GC/Not GC.

I really don't want to enter here, but I'm unhappy with this kind of discussions and I find myself driven to use other languages where they have made that decision clearly: Nim has GC (you can select the GC strategy), Rust has not GC.

i.e.: Official "high level" libraries for common uses (i.e.: Database libraries)

1 week ago I "returned" to D after some months... I need to perform a simple database task (with postgres) and I found that dpq2 was the most "recommended" one (Dlang site itself). It has vibe-d dependency (nice!!! may be it's based on fibers!!!)

The library didn't compile (it references an old vive-d version with deprecated code)... I created an issue on github with the problem and maintainer didn't recognize the problem (initially). Finally I modified manually the library and tried to run the example proposed in "examples" folder but DMD couldn't compile because some strange missing things on system libraries with my Ubuntu...

I have not mentioned that for checking it, I first created an small webserver using the example you can find in D home page... surprise!!! it didn't compile neither because references the same vive-d deprecated version (after updating the version, all worked enought).

It was enough for me. May be next year :-) (and it will be my N-D try).

October 15, 2021

On Friday, 15 October 2021 at 09:47:48 UTC, Antonio wrote:

>

Rust has not GC.

Rust has GC, i.e. reference counting. This is also often required with multiple ownership which you often end up with in data structures. I would rather say GC is mandatory in Rust, unless you want to take the unsafe approach.

It's a matter what you regard as GC. Is only tracing GC regarded as true GC?

October 15, 2021

On Friday, 15 October 2021 at 09:53:18 UTC, IGotD- wrote:

>

On Friday, 15 October 2021 at 09:47:48 UTC, Antonio wrote:

>

Rust has not GC.

Rust has GC, i.e. reference counting. This is also often required with multiple ownership which you often end up with in data structures. I would rather say GC is mandatory in Rust, unless you want to take the unsafe approach.

It's a matter what you regard as GC. Is only tracing GC regarded as true GC?

Hi IGotD- really fast response :-)

Nim has reference counting too (combined with "cycle" detection "true" GC)... I really love not to use the "ownership" pattern (it's like strait jacket)... some "functional" tries with Rust results in "hard to read" code... As time goes by, I find it harder to be imperative.

When I say that GC/Not GC is a problem is because there is an eternal discussion in forums and D maintains itself "neutral" when, in fact, it is a GC language... There is Walter experimental tries to introduce "ownership" equivalent (at least last time I review), there is people requesting a non GC based Phobos library...

I consider myself an "external observer". May be D must introduce the Nim filosofy about GC( select your best option: Pure GC, Counter + GC, Counter only) and developer must be responsible about avoiding problems under the selected scenary, and Phobos must be compatible with the most restrictive one (Counter only)

My point is about D must be clear and advance, it's impossible to keep everyone happy.

October 15, 2021

On Friday, 15 October 2021 at 09:47:48 UTC, Antonio wrote:

>

On Monday, 11 October 2021 at 15:59:10 UTC, Atila Neves wrote:

>

[...]

About Wrong D features:

In my opinion, D is afraid of embracing decisions with all it's consequences... it maintains itself in a position where nothing is "the best for niche X"

[...]

I'm not sure what you mean by your gc/nogc comment. Could you clarify? D allows for all approaches afaik