June 16, 2022
On Thursday, 16 June 2022 at 10:46:33 UTC, forkit wrote:
>
> My point is, either it supports one of the most important aspects I've worked with in OOP over 20 years, or it doesn't.
>
> i.e. it doesn't.
>
> would be nice if it did - 'if' it could fit in the language and work well with other things.
>
> are you suggesting i want it in the language, no matter what the cost is?

I am suggesting that if I copied and pasted some random D feature in another language, it may not fit in that language, because the context is different. D has already some features that don't play along well together (immutability and OOP, for instance).

I am suggesting that 'because some other language has it' is not a valid argument, whether or not that language is successful.

I am suggesting language design is hard.

I am suggesting you write a DIP, so you can come with an evaluation of this cost, since you are the one asking for it.



June 16, 2022

On Thursday, 16 June 2022 at 11:40:16 UTC, forkit wrote:

>

the constraint is optional, just as using meta programming is optional.

It isn't optional if you write libraries that other people depend on. If someone gives your library a type, then you need to deal with that type.

June 16, 2022
On Thursday, 16 June 2022 at 11:48:08 UTC, Ola Fosheim Grøstad wrote:
> On Thursday, 16 June 2022 at 11:40:16 UTC, forkit wrote:
>> the constraint is optional, just as using meta programming is optional.
>
> It isn't optional if you write libraries that other people depend on. If someone gives your library a type, then you need to deal with that type.

well I've never written a library that others depends on to do metaprogramming ;-)

what I'm saying, is if you do, the design constraint is optional.

I cannot answer the question as to whether allowing a class to have members that are private to the class, would have a negative impact on metaprogramming in D.

If someone is saying that it will, then .. can they please explain how and why that would be, so we can all understand?
June 16, 2022

On Thursday, 16 June 2022 at 12:02:17 UTC, forkit wrote:

>

I cannot answer the question as to whether allowing a class to have members that are private to the class, would have a negative impact on metaprogramming in D.

If someone is saying that it will, then .. can they please explain how and why that would be, so we can all understand?

If you can detect it, then it is a breaking change in the context of meta-programming.

It is up to you to prove in your DIP that it cannot be detected if you claim that it is a non-breaking change.

June 16, 2022
On Thursday, 16 June 2022 at 11:10:33 UTC, Kagamin wrote:

>
> When you have a lazily initialized field, you need to use an accessor, because if you read the raw field, you get an uninitialized value and error as a result, so only the accessor should have access to the field.

You can do that already for static/global functions by placing the cache in the function scope. In D, you can't access a function's scope at all, so it is true encapsulation.
June 16, 2022

On Thursday, 16 June 2022 at 10:41:03 UTC, Ola Fosheim Grøstad wrote:

> >

Module-private already doesn't play well with other D features ('invariant()', 'synchronized')

In what way are they affected?

They assume encapsulation is at the class level.

June 16, 2022

On Thursday, 16 June 2022 at 12:27:43 UTC, Max Samukha wrote:

>

On Thursday, 16 June 2022 at 10:41:03 UTC, Ola Fosheim Grøstad wrote:

> >

Module-private already doesn't play well with other D features ('invariant()', 'synchronized')

In what way are they affected?

They assume encapsulation is at the class level.

Yes, but they also assume full encapsulation "Smalltalk style".

June 16, 2022

On Thursday, 16 June 2022 at 12:08:27 UTC, Ola Fosheim Grøstad wrote:

>

If you can detect it, then it is a breaking change in the context of meta-programming.

Isn't that like saying: adding a uint128 type breaks the language. Because you can detect it?

June 16, 2022

On Thursday, 16 June 2022 at 13:02:11 UTC, Chris Katko wrote:

>

On Thursday, 16 June 2022 at 12:08:27 UTC, Ola Fosheim Grøstad wrote:

>

If you can detect it, then it is a breaking change in the context of meta-programming.

Isn't that like saying: adding a uint128 type breaks the language. Because you can detect it?

It is and I think it's far from a solid argument against anything.

If your meta programming depends on something as trivial as those and will break with any minor changes like that then your code is probably wrong to begin with.

June 16, 2022

On Thursday, 16 June 2022 at 13:02:11 UTC, Chris Katko wrote:

>

Isn't that like saying: adding a uint128 type breaks the language. Because you can detect it?

Depends on whether the language provides a "mandated" mechanism in the standard library for dealing with arbitrary bit widths. Since cent has been known as a potential 128bit type, you probably should try to write generic code over integers using generic mechanisms where available.

But yes, most extensions at the language level can break things. It is less problematic to do it as extensions of the standard library with optimizations (that ends up using 128 bit instructions). The result would be the same, just non-breaking.