Ticket #2038 (new deprecation)
Singleton PMCs are deprecated
Reported by: | whiteknight | Owned by: | |
---|---|---|---|
Priority: | trivial | Milestone: | 3.9 |
Component: | core | Version: | master |
Severity: | medium | Keywords: | newbie |
Cc: | Language: | ||
Patch status: | Platform: | all |
Description
Parrot shouldn't be responsible for implementing the singleton contract for PMCs. Our current implementation of it is very bad anyway.
If HLLs or other projects want singletons, they should be able to implement the behavior themselves.
Types such as Env and OS don't have state so don't need to be singletons. They are basically just collections of methods, and it's very cheap for us to just create multiple copies of them if needed.
The scheduler is a different story. It does have state, so we need to only have one of those in the system at a time. There are ways to prevent users from creating a scheduler from PIR code. The scheduler reference is available (or should be) by introspecting the current interp PMC.