Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
perl6 中单例模式的正确实现是什么?
我已经尝试过了,但我不知道如何在 perl6 中使用 static 关键字:
这是需要使用bless方法的少数原因之一
bless
class Singleton { my Singleton $instance; method new {!!!} submethod instance { $instance = Singleton.bless unless $instance; $instance; } }