Open Chriscbr opened 1 year ago
Is this proposing that by default it won't be possible to initialize objects from a class?
If so, in the above example it shouldn't be possible to instantiate MyService
because its init
is private, no?
@eladb Fixed
Hi,
This issue hasn't seen activity in 60 days. Therefore, we are marking this issue as stale for now. It will be closed after 7 days. Feel free to re-open this issue when there's an update or relevant information to be added. Thanks!
Hi,
This issue hasn't seen activity in 60 days. Therefore, we are marking this issue as stale for now. It will be closed after 7 days. Feel free to re-open this issue when there's an update or relevant information to be added. Thanks!
Hi,
This issue hasn't seen activity in 90 days. Therefore, we are marking this issue as stale for now. It will be closed after 7 days. Feel free to re-open this issue when there's an update or relevant information to be added. Thanks!
Hi,
This issue hasn't seen activity in 90 days. Therefore, we are marking this issue as stale for now. It will be closed after 7 days. Feel free to re-open this issue when there's an update or relevant information to be added. Thanks!
Feature Spec
Starting in Wing 0.x, class initializers are now private by default, unless specified public using the
pub
keyword. Previous to this change, it was not possible to define private constructors in Wing.Here's an example of how private constructors can be used to implement the singleton design pattern:
Use Cases
There are several common use cases for private constructors:
Implementation Notes
No response
Component
Compiler
Community Notes