June 13, 2022
On Sunday, 12 June 2022 at 23:09:22 UTC, forkit wrote:
> On Sunday, 12 June 2022 at 12:26:33 UTC, Chris Katko wrote:
>>
>> If I could have private (or any keyword that mimics C++ private) as a optional compiler flag, I would turn that on in a heartbeat.
>
> That is actually a decent alternative (i.e. an 'optional' compiler switch).
>
> But even with the support of the D community, this would likely end up being something that Walter would have to implement (in that messy thing known as the frontend).
>
> I'm sure he would give it is foremost attention ;-)
>
> To be honest, the more I look into Swift (I only started a few days ago), the less impressed I am with D.
>
> I think Swift has a really bright future actually.
>
> https://docs.swift.org/swift-book/GuidedTour/GuidedTour.html

Swift has definitly a bright future no matter what, because it has one of the most powerful companies that asserts that is the only way to play on their turf going forward, besides Objective-C and C++.

Unfortunely the time for such kind of big industry players to pick D has moved on, they are now busy with Go, Rust, or adding to Java, .NET and C++ the missing pieces that made D a better option, while having a much bigger ecosystem in tooling and libraries.
June 13, 2022
On Monday, 13 June 2022 at 05:11:31 UTC, forkit wrote:

> oh. I misread the question.
>

Yeah, I misread the suggestion.

June 13, 2022

On Monday, 13 June 2022 at 06:09:34 UTC, Paulo Pinto wrote:

>

On Sunday, 12 June 2022 at 23:09:22 UTC, forkit wrote:

>

[...]

Swift has definitly a bright future no matter what, because it has one of the most powerful companies that asserts that is the only way to play on their turf going forward, besides Objective-C and C++.

Unfortunely the time for such kind of big industry players to pick D has moved on, they are now busy with Go, Rust, or adding to Java, .NET and C++ the missing pieces that made D a better option, while having a much bigger ecosystem in tooling and libraries.

Isn't stuff like Dart also feasible on Apple though, due to its amazing portability (ie, Flutter)?

Doubt non Apple people will pick up Swift, but it'll definitely work the other way round

June 13, 2022

On Monday, 13 June 2022 at 06:38:13 UTC, Tejas wrote:

>

On Monday, 13 June 2022 at 06:09:34 UTC, Paulo Pinto wrote:

>

On Sunday, 12 June 2022 at 23:09:22 UTC, forkit wrote:

>

[...]

Swift has definitly a bright future no matter what, because it has one of the most powerful companies that asserts that is the only way to play on their turf going forward, besides Objective-C and C++.

Unfortunely the time for such kind of big industry players to pick D has moved on, they are now busy with Go, Rust, or adding to Java, .NET and C++ the missing pieces that made D a better option, while having a much bigger ecosystem in tooling and libraries.

Isn't stuff like Dart also feasible on Apple though, due to its amazing portability (ie, Flutter)?

Doubt non Apple people will pick up Swift, but it'll definitely work the other way round

Maybe, that also boils down to the same basic example anyway, one of biggest corporations on the world (Google), pushing a cross platform framework (Flutter), where only one language gets to play (Dart).

June 13, 2022

On Sunday, 12 June 2022 at 14:56:53 UTC, Mike Parker wrote:

>

On Sunday, 12 June 2022 at 14:05:00 UTC, Max Samukha wrote:

>

On Sunday, 12 June 2022 at 11:47:53 UTC, Mike Parker wrote:

>

Hi, Mike! Congratulations on being the first unsurprised D user! (You were actually surprised for a moment, weren't you?)

No. Nor was I surprised, for example, when I learned that in Python all members are public, or that protected in C# is more restrictive than protected in Java.

Every language has a similar approach as other languages to some things, a different approach to others. I've investigated enough programming languages that I learned long ago to be open to the differences and never to expect that just because something is true in Language A that it will be true for a similar feature in Language B.

I often have reactions of "neat" or "cool", or "too bad" or "that sucks", but I can't say I'm ever really surprised when You have to learn to think in the language you're using if you want to be productive with it, and that means accepting the differences. You may find some things grate on your nerves because they don't square with your view of the world, in which case you either push to change them, accept them, or, if it's too much to handle, move on to a language that better fits your mental model. The latter is why I never stuck with C++.

The problem is that there are no 'practical' languages to move on to. All of them make you maintain inconsistent metal models. Like, 'synchronized' is class-level, its semantics is based on the assumption that 'private' is class-level too, but it is not, so 'shared' is broken as a consequence.

>

When I first learned about D's private-to-the-module approach, it made perfect sense to me. It fits right in with D's concept of modules.

Right. The problem is it doesn't fit in with the concept of classes.

>

I have been surprised occasionally, though, when I was certain a feature worked a certain way, but I learned later my understanding was wrong. There were a couple of those instances when I was writing Learning D, but I can't for the life of me remember what they were.

Yes, I have a similar experience. Some of the features made perfect sense after I had learned the reasoning behind them. Unfortunately, the module-level 'private' is not one of those.

June 13, 2022
On Sunday, 12 June 2022 at 17:42:32 UTC, Adam D Ruppe wrote:
> On Sunday, 12 June 2022 at 14:05:00 UTC, Max Samukha wrote:
>> (You were actually surprised for a moment, weren't you?)
>
> Actually, when I used PHP's classes the first time, I as so perplexed at why this private thing was giving an error when the code was right next to it.
>
> It just seems so unnatural.

But then 'private' on modules should not seem more natural to you as well.
June 13, 2022
On Monday, 13 June 2022 at 04:39:23 UTC, Mike Parker wrote:
>
> Right now, you can split your module into two files and present them to the world as a single module with package.d. What does your suggestion buy us that this doesn't aside from a single module name trait?

Let's see.

a.d
```
module a;

class Foo
{
	private:
	int _c;
}

import b;
void handle(Bar child)
{
  child._c += child.c;
}
```
b.d
```
module b;

import a;

class Bar : Foo
{
	public:
	int c;

	this(int c)
	{
		this.c = c;
	}
}
```

main.d
```
module main;

import a;
import b;

void main()
{
	auto bar = new Bar(30);
	handle(bar);
}
```

If D is truly "module private" then the above should be able to compile, if it's "class private" then it shouldn't be able to compile.

Since the above doesn't compile then D isn't really "module private" and thus the conclusion is that one of the most fundamental features of D is also an unfinished feature.

D states it is "module private" but really it is neither "module private" or "class private" it's a mix between the two... and I'm not sure whether that's good or not.
June 13, 2022
On Monday, 13 June 2022 at 07:59:24 UTC, bauss wrote:
> <snip>

It does what I would expect it to do. What exactly is the issue with this?


June 13, 2022
On Monday, 13 June 2022 at 07:59:24 UTC, bauss wrote:

>
> If D is truly "module private" then the above should be able to compile, if it's "class private" then it shouldn't be able to compile.
>
> Since the above doesn't compile then D isn't really "module private" and thus the conclusion is that one of the most fundamental features of D is also an unfinished feature.

But why should that compile? You're trying to manipulate `_c` through an instance of `Bar`. It's not visible in any `Bar`, ever, so why should it be visible here? It has to be gotten at through the interface of `Foo`.

June 13, 2022

On Sunday, 12 June 2022 at 14:05:00 UTC, Max Samukha wrote:

>

On Sunday, 12 June 2022 at 11:47:53 UTC, Mike Parker wrote:

>

Hi. My name's Mike. Nice to meet you.

Hi, Mike! Congratulations on being the first unsurprised D user! (You were actually surprised for a moment, weren't you?)

Anyone who used Object Pascal / Delphi wouldn't have been surprised either.