Date: Sat, 22 Feb 2020 00:18:50 +1100
>
> Matt, if this were to become a language thing, I don't see how the above
> could be done so easily. I also wonder how it would handle a function
> declaration that occurs /after/ the "using new" statement. If A and B are
> both using new X, and a function f(X, X) is declared after the definitions
> of A and B, is f(A, A) valid? f(A, B)?
>
Thank you for the feedback.
My simplistic view of "using A = new X" or "using new A = X" or
"using_otherwise_adorned A = X" is simply to be similar to "struct A {}"
where A is "clone" of X but not an alias in the type system. I imagine
extension methods to add methods would be useful in this picture but
somewhat orthogonal.
Perhaps to handle your example of preventing ops in an inappropriate
domain, such as the time add, = delete or extension removal would also make
sense. That is, using an extension method for adding the delta and an
extension deletion for removing the addition of time to time.
Such a slightly different way of looking at the type system may also make a
contribution to the ABI/performance debate.
I'm not sure if adding data to a clone would also make sense due to the
layout changes. I can see it being useful but *different* from both cloning
a type and inheritance as an alternative composition technique.
Kind regards,
--Matt.
> Matt, if this were to become a language thing, I don't see how the above
> could be done so easily. I also wonder how it would handle a function
> declaration that occurs /after/ the "using new" statement. If A and B are
> both using new X, and a function f(X, X) is declared after the definitions
> of A and B, is f(A, A) valid? f(A, B)?
>
Thank you for the feedback.
My simplistic view of "using A = new X" or "using new A = X" or
"using_otherwise_adorned A = X" is simply to be similar to "struct A {}"
where A is "clone" of X but not an alias in the type system. I imagine
extension methods to add methods would be useful in this picture but
somewhat orthogonal.
Perhaps to handle your example of preventing ops in an inappropriate
domain, such as the time add, = delete or extension removal would also make
sense. That is, using an extension method for adding the delta and an
extension deletion for removing the addition of time to time.
Such a slightly different way of looking at the type system may also make a
contribution to the ABI/performance debate.
I'm not sure if adding data to a clone would also make sense due to the
layout changes. I can see it being useful but *different* from both cloning
a type and inheritance as an alternative composition technique.
Kind regards,
--Matt.
Received on 2020-02-21 07:24:58