Hi Richard,

On 12/12/2013 08:56 AM, Richard Hainsworth wrote:
I would like to set a series of magic numbers from the command line.

I have in a program

constant N-SCENARIOS = 10;

which works great. But I would like to set an option in the command
line, such as
perl6 program.p6 scenarios=15

.. then it's not a constant. So don't use a constant. Use a variable instead.

I could have a normal scalar
my $scenarios ;

But that doesn't seem as elegant as creating a constant.

Using a constant for something that isn't a constant doesn't strike me as elegant at all.

Note that in Perl 6, there is no guarantee that command line arguments are known at compile time, so mucking with @*ARGS in BEGIN seems like a very bad idea.


Reply via email to