[m-rev.] for review: auto detection of library grades
Julien Fischer
jfischer at opturion.com
Tue Sep 3 16:43:36 AEST 2013
On Tue, 3 Sep 2013, Paul Bone wrote:
> On Tue, Sep 03, 2013 at 04:12:48PM +1000, Paul Bone wrote:
>> On Wed, Aug 28, 2013 at 05:47:00PM +1000, Julien Fischer wrote:
>>> + globals.lookup_bool_option(Globals, auto_detect_libgrades, AutoDetect),
>>> + (
>>> + AutoDetect = yes,
>>> + ( if
>>> + % Was the standard library directory set on the command line?
>>> + % + globals.lookup_maybe_string_option(Globals,
>>> + mercury_standard_library_directory, MaybeStdLibDir),
>>> + MaybeStdLibDir = yes(MerStdLibDir)
>>
>> Some strange formatting in your patch.
>>
>>> + then
>>> + do_auto_detect_libgrades(MerStdLibDir, GradeOpts, !IO)
>>> + else if
>>> + % Was the standard library directory set using the
>>> + % MERCURY_STDLIB_DIR variable?
>>> + MaybeConfigMerStdLibDir = yes([MerStdLibDir])
>>> + then
>>> + do_auto_detect_libgrades(MerStdLibDir, GradeOpts, !IO)
>>> + else
>>> + GradeOpts = [] + )
>>
>> You can factor out common code by putting both ITE conditions in a
>> disjunction and then using a single then branch.
>
> Actually never mind, since this produces a value it'd be nondet.
The real issue is that the order here is important, the command line
option should override the variable, and if the compiler were to reorder
the disjunction, it would stuff things up. I'll add a comment to that
effect.
Cheers,
Julien.
More information about the reviews
mailing list