#1704: Implicit selection of main sub is deprecated.
-------------------------+--------------------------------------------------
Reporter: bacek | Owner:
Type: deprecation | Status: reopened
Priority: normal | Milestone: 3.0
Component: imcc | Version: trunk
Severity: medium | Resolution:
Keywords: | Lang:
Patch: | Platform:
-------------------------+--------------------------------------------------
Comment(by pmichaud):
Note that NQP allows pirflags (including :main) to be attached to a sub
using the 'is pirflags<...>' trait.
sub MAIN() is pirflags<:main> {
...
}
One can also use 'is pirflags<...>' to add :vtable flags and the like.
That said, the elimination of implicit :main selection is likely to break
a fair bit of NQP and PCT programs, because they have been relying
somewhat heavily on the implicit main selection. I suppose we can work
around this by having PCT/NQP always explicitly marking the first sub as
:main.... but that seems problematic also (especially if PCT/NQP is
generating code that is intended to be .include'd as part of a much larger
PIR source, as is the case for many things in Rakudo.
The ticket claims that implicit :main needs to be eliminated to enable
validation of 0-arity subs... but the discussion in #parrotsketch cited
above clearly says that the two issues (checking arity and marking :main)
are orthogonal issues and should not have been linked. I agree with that
assessment, and thus there's no strong reason for removing implicit :main.
I think we should continue to allow implicit :main, and simply enable
arity checking on all subs. The ability to write a :main (implicit or
explicit) with no parameters is all that needs deprecating.
Pm
--
Ticket URL: <https://trac.parrot.org/parrot/ticket/1704#comment:3>
Parrot <https://trac.parrot.org/parrot/>
Parrot Development
_______________________________________________
parrot-tickets mailing list
[email protected]
http://lists.parrot.org/mailman/listinfo/parrot-tickets