Closed apblack closed 5 years ago
so, we've built singleton into the language....
I think that this is featherweight flyweight. We get Singleton using an object constructor rather than a class.
Should we not have once class
, and instead require once method { object ...
? Seems non-orthogonal.
On 12/04/2019, at 16:55PM, Andrew Black notifications@github.com wrote:
I think that this is featherweight.
you're right: flyweight.
We get Singleton using an object constructor rather than a class.
yeah, I know. although if the class has no parameters it collapses.
Should we not have once class, and instead require once method { object ...? Seems non-;orthogonal.
if we have once, we should have the othernce
although I prefer class/object ... is once.
although I prefer class/object... is once.
We did talk about that. Annotations are not supposed to change the semantics — just make things legal or illegal. I'm not sure if we really observe that rule, though.
Fixed in commit be6602a
The syntax
should be legal and have the same meaning as
by analogy with ordinary methods.
This ought to be easy to implement, because
class
es are parsed intomethodNode
s, which already supportonce