Since last week's post-YAPC hackathon I've been trying to write tests for 
config/inter/lex.pm, 
the package which governs Parrot configuration step inter::lex.  Per the POD, 
this step "[d]
etermines whether 'lex' is installed and if it's actually 'flex' of least the 
user-specified 
minimum version, defaulting to 2.5.33."

In the Phalanx-model of testing, we try to write enough tests to exercise every 
statement in 
the code and, within each statement, each branch and condition.  One major 
implication of 
this is that we try to write tests to cover each 'return' statement from each 
subroutine within 
the code.  In the case of config/inter/lex.pm, this is quite a challenge, since 
its subroutine 
'runstep()' has no fewer than *eight* return statements, i.e., eight different 
possible 
outcomes for running this configuration step.  (This is also true of 
config/inter/yacc.pm.)

I anticipate writing a series of posts to this RT ticket about different 
aspects of config/inter/
lex.pm.  To start, let me ask about the '--maintainer' option to Configure.pl.  
This 
configuration option was added four years ago "to work around imcc 
dependencies."  When 
set, its most important effect appears to come in config/auto/gcc.pm later in 
the 
configuration process when it causes Parrot to be compiled with " 
-Wlarger-than-4096".

Two years ago, however, Configure.pl and config/inter/lex.pm were modified such 
that:

(a) If either of the '--lex' or '--yacc' options to Configure.pl were set, the 
'--maintainer' 
option would be set as well.

(b) If the '--maintainer' option was *not* set (either explicitly or implicitly 
by setting '--lex' 
or '--yacc'), then configuration step inter::lex immediately short-circuits.  
It makes no further 
attempt to determine whether you have a 'lex'-like program on disk or whether 
you have a 
sufficient version of 'flex'.  You are not prompted to provide input on STDIN.  
A result of 
'skipped' is set; 'runstep()' exits; and configuration goes on to the next step.

    unless ( $conf->options->get('maintainer') ) {
        $conf->data->set( $util => 'echo' );    # here, $util = 'lex'
        $self->set_result('skipped');
        return $self;
    }

Since you have to explicitly set certain options to Configure.pl to get past 
this point in 
inter::lex, Parrot's configuration by default does not attempt to determine 
whether you have 
a 'lex'-like program available.

My question is this:  Is this a good thing?

In other words, is it good that, by default, Parrot's configuration does *not* 
attempt to 
determine whether you have a 'lex'-like or 'yacc'-like program on disk?  Are we 
depriving the 
Makefile of any significant information by customarily sidestepping this probe? 
 Shouldn't 
Parrot's default configuration behavior be to seek out information rather than 
to skip that 
search?

Thank you very much.
kid51

Reply via email to