New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No way of having new versions of CORE classes for new language revisions #71
Comments
To extend the subject a little bit, I'd like to confirm what was expected: two user modules of two different versions provide two different classes too. What it could end up with? Say, a class Then, lets assume there're 3rd party classes
outputs:
Because the end-user may not and must not know the internals of the modules he is using this situation would be absolute LTA to him. |
Just some tentative thoughts. The core of the problem is types not matching to each other. I think there must be a way to proclaim a type object to be a different version of an existing one. Few options I have in my mind:
Second problem is coercion methods on |
Well, if it's a different implementation, is it in any sense the same class? Let's take the specific example of (As an aside: I'm not sure whether it even should become So far as modules go, I think the common case is that we can evolve roles and classes without breaking their compatibility. A |
The whole thing stems from rakudo/rakudo#1203. And to my view when
results in:
It goes totally against DWIM and common logic. If a set of sets is needed then braces would serve well for this, for example. Especially contr-intuitive are I played with iterable Now, back to the roots. I actually agree that a new class version is a new class by itself. The more I think of it, the less reasonable I see the idea of proclaiming different versions as the same entity. But lets assume that it is decided that
The second method would coerce any Another problem remains: coercion methods on other classes. Again, as a typical example: what
Or with special quoting: Perhaps these two changes could work to solve the problem. |
As far as I can remember, when I asked TimToady what the behaviour of that situation should be, he decided for the current behaviour. AKA, QuantHashes are an item. I can see the inconsistency. I have no problem in fixing that inconsistency. |
@lizmat hope I get you right: the current behavior remains unchanged? If so, I would close all related tickets, including rakudo/rakudo#1203 and #47 . |
No, that's not what I'm saying. I'm open to change, but I will not take that decision. |
Ok, noted. ;) Whichever way it goes, the problem of introducing new implementations of classes would stick around anyway. So, I'd like to know if it makes sense in trying to implement typeobject versioning via
or by multidispatching:
|
I know that 1) It’s most probably very very difficult to implement and has nothing quite like it yet 2) it doesn’t help much the Set situation 3) it doesn’t help resolve several classes with different :auth<> 4) has classes thinking they’re the same 5) ...probably some other things. Here’s an example, pseudo code with Ruby syntax. module Perl6e; # should this be a simple package?
refine Any {
method Set { ... }
}
refine Set {
method append { ... }
} This is Ruby’s way of making monkey patching lexical (instead of what’s usually done in Ruby...), but it looks a tiny bit similar to our issue at hand |
Closing via rakudo/rakudo#3112 |
Turns out there is no way to have another implementation of the same class in another
CORE.setting
. It could have the same name, would successfully perform under it's corresponding language pragma. But... Those withHEAD
installed can try the following:type-match.pm6:
type-match.p6:
This code outputs
True
withuse v6.c
in type-match.p6 butFalse
withuse v6.e.PREVIEW
! And it makes sense because another implementation ofPseudoStash
is definedCORE.e.setting
.What implications does it has? While trying to solve #47 I realized that just re-declaring
QuantHash
and addingIterable
role to it is not enough, roles and classes consuming it must also migrate intoCORE.e.setting
. Next, I stumble upon a method where an arbitrary object must be coerced intoSet
. TheSet
method for this is defined inAny
. It is creating a newSet
object. ButAny
resides inCORE.setting
and the method will create object using6.c
version ofSet
!Do I need to move
Any
too? But that would mean moving just plain everything (as everything depends onAny
)! And this is where problems are starting. What are we gonna do about all routines with signatures referring toAny
? Because we now have two of those. Wether the signature would match or not will depend on which language version the object has been constructed under!For now I have only the description of the problem, not a single idea of how to deal with it.
The text was updated successfully, but these errors were encountered: