On Saturday, 27 July 2013 at 12:19:44 UTC, John Colvin wrote:
On Saturday, 27 July 2013 at 01:09:03 UTC, Jesse Phillips wrote:
On Friday, 26 July 2013 at 00:38:46 UTC, John Colvin wrote:
After a few weeks of not getting around to it, here's my
second post:
http://foreach-hour-life.blogspot.co.uk/2013/07/the-first-corner-n-for-echo.html
BTW, std.getopt is a good way to parse arguments. Not sure if
it is relevant to what you want to teach, but should generally
be preferred over handwritten.
I'm pretty sure it wouldn't work ideally for echo as the
behaviour depends on the order of the arguments.
getopt knows how to handle ordering, it's really just a matter of
echo's argument parsing rules being different from classic getopt.
For example, echo does not handle "--" argument (end of options
mark), which means it is literally impossible for echo's first
"string argument" to be "-n".
So for example, while "echo -- -n" would print "-- -n", a getopt
echo would print "-n".
Arguably, this is better behavior, but if the goal is exact
replication, then it's wrong :/