[m-rev.] diff: io.get_environment_var on java
Peter Wang
novalazy at gmail.com
Thu Aug 13 14:36:55 AEST 2009
On 2009-08-13, Paul Bone <pbone at csse.unimelb.edu.au> wrote:
> On Thu, Aug 13, 2009 at 11:27:42AM +1000, Peter Wang wrote:
> > On 2009-08-13, Paul Bone <pbone at csse.unimelb.edu.au> wrote:
> > >
> > > When you use 'command()' to run a sub command and wait for it in Java does it
> > > support environment variables? If so keeping a map of changed environment
> > > variables can be used to override any set for sub-processes as well as any
> > > retrieved by io.get_environment_var.
> >
> > It's possible to do that but I'm not sure we should.
>
> Without thinking about it too hard I can think of the following pros and cons.
>
> Pros:
> + It means one can export environment variables to child processes.
> + set_environment_var has consistent behaviour across more backends.
>
> Cons:
> + It's more work, if we get what we want with less work then that's easier.
> + If a programmer uses other foreign code to start child processes
> environment variable bindings won't be exported. This may not be what
> programmers expect.
>
> Why do you say we shouldn't do this?
Because of the second con. io.set_environment_var will appear to work
until someone mixes Mercury and Java code, possibly resulting in a
subtle bug.
On the other hand we could add a version of io.call_system with takes a
list of environment variables, then people who need portability to Java
can use that instead.
Peter
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to: mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions: mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------
More information about the reviews
mailing list