Closed dk closed 2 years ago
This is currently implemented in Object::Pad and there's really no technical reason it can't be part of Corinna.
I would prefer to allow class Foo;
. The only caveat is that classes are intended to be "sealed" at the end of their compilation. But I think we could define classes to end at the end of the compilation unit, as well as if the class or package is changed.
This might eventually happen, but for now, the postfix block means we don't need to worry about lexical leaking into another scope, or new keywords leaking beyond that scope. We have a much more constrained problem space.
Per our Principle of Parsimony, not requiring a postfix block for the MVP could be a decision that would be hard to walk back if people start relying on Corinna, but a postfix block is trivial to walk back. Thus, this is a post-MVP discussion.
Update: I see some issues were addressed above by Grinnz and haarg. We might make this happen later, but I would really prefer avoiding this in the MVP.
Closing this ticket. We may (will) revisit post v1.
I read the recent Damian Conway's article on the OO syntax, and one thing has struck me which is a bit inconsistent in the class {} syntax. Namely, his code example uses both "package X {}" and "class X {}" for declaring stuff for, respectively, packages and classes, but since Cor is not interested in packages, and perl already has the "package X;" syntax, these two namespace declarations are not that close to each other as I think as they may (and should) be.
What I mean is that since we have already
why shouldn't we have also
?
That would be consistent with the existing syntax, and also all declarations won't need that extra space in front of them as in