[m-rev.] for review: bugfix for io.set_environment_var/4

Mark Brown mark at mercurylang.org
Mon Apr 18 12:59:33 AEST 2016


Hi,

On Mon, Apr 18, 2016 at 10:30 AM, Peter Wang <novalazy at gmail.com> wrote:
> On Mon, 18 Apr 2016 09:49:23 +1000 (AEST), Julien Fischer <jfischer at opturion.com> wrote:
>>
>> W.r.t to Mark's change: I think we also need to add
>>
>>      :- pred have_set_environment_var is semidet.
>>
>> so that programs can test whether the unerlying platfrom supports
>> modifying the environment.
>>
>
> Or just add a version of io.set_environment_var that returns a success
> code instead of throwing an exception.

I've pushed the version that uses setenv, as nobody has objected and
the fix for set_environment_var/4 is needed in any case.

I agree with Julien's scheme: a portable application is likely to want
to call these feature test predicates at the start, and decide what it
can and can't do once and for all, rather than checking at each call
that requires the feature. There are other possible errors though, so
a version that returns an io.res also seems appropriate. Any other
views on this?

Cheers,
Mark


More information about the reviews mailing list