Hi David,
thanks for your contribution. I'll review it thoroughly in the next few
days.
Am 24.05.2010 21:14, schrieb David Green:
Also the line that sets the "but False" variations is commented out for now,
because "but" isn't working.
That's a reason why the challenge included only the simple cases in the
first case :-)
The tests might need fixing too, since I'm not sure whether eqv (as used by
is_deeply) would cover that, or whether it would take a separate test in bool
context.
probably the latter.
Instead of a %boolean-names hash, I used an array to hold those parameter
names, as well as @arrays to hold the array-parameters. Or it would be pretty
easy to change to a hash that maps the parameter names onto their types, or
something like that.
After playing with the first submission, the hash of types is what I
found most useful.
See
http://github.com/moritz/process-cmd-args/blob/master/process-cmd-args.p6#L256
for some code that actually generates it by introspecting the signature
of sub MAIN.
I also added a %shorts param that maps short arg-names onto their full names.
The spec doesn't elaborate on how the short args are specified in the
signature of MAIN. I see two possible approaches (that don't contradict):
1) one renames them in the signature, so it would like
sub MAIN(:name(:$n))
then $n has two names, 'name' and 'n', and we could consider all
one-letter parameter names as short names
2) Iterate over all named parameters and build unambiguous prefixes. If
any of them is just one letter short, we consider it a short name.
Anz opinions from p6l about it?
I have a few questions about the spec that are worth clarifying on p6l,
but despite some slow going, I'm pleased to find that some aspects of
P6 have already settled nicely in my brain.
Great to hear that.
Is there anything (except better error reporting) that Rakudo could do
to further ease the learning?
We're always looking for feedback from new hackers.
Cheers,
Moritz