On Feb 6, 2006, at 10:04, Leopold Toetsch via RT wrote:
Allison Randal wrote:
What's the difference between :optional and :opt_flag? I found a few
lines of documentation on these once I knew what to grep for, but
that's all.
Seed pdd03. :optional is the argument. :opt_flag is 1/0 if the
argument
was passed or not.
Ah, need a case insensitive grep for that one. (pdd03 doesn't contain
the strings "opt" or "optional" anywhere, only "OPT" and "OPTIONAL".)
Marking optional parameters is a good move forward. But... retrieving
garbage values into parameters that aren't passed an argument is
not a
good design for a stable system.
Of course. The plan is to turn on argument/return value count
checks on.
See some recent discusson on p6i, e.g. "Param count checks" ;)
On by default? Or on-all-the-time-you-can't-turn-it-off-even-if-you-
want-to?
If it's the former, the problem still needs to be solved.
You can turn it on manually with the errorson opcode too, see
t/op/calling.t for examples.
I'll use this to ferret out the places where Punie and TGE use
optional parameters. But I'm more concerned about the overall design
question than I am about Punie. (Punie is an exercise to explore what
we want out of the AST interface and find potential obstacles to
other language implementations.)
Allison