(j3.2006) Fw: a question on MERGE and expression evaluation

Van Snyder Van.Snyder
Thu Nov 18 21:14:35 EST 2010

On Thu, 2010-11-18 at 17:58 -0800, Malcolm Cohen wrote:
> Jim Xia writes:
> > But I'm afraid there will be users picking 12.5.3 as an evidence that standard 
> > mandate the evaluation
> This has not been a problem in the last 50 years, why should it suddenly become 
> one now.
> >The second sentence in 12.5.3 does seem conflict with other text, and should be 
> >fixed.
> I don't agree with either claim, and I don't want to start putting weasel 
> wording all over the shop, and if I did I wouldn't start here.

I definitely don't want to start with MERGE, because I'd like someday to
see it explicitly require lazy evaluation (which is presently allowed
but not required), at least in the scalar-mask case.  Either that or get
conditional expressions (with lazy evaluation of either the consequent
or anti-consequent, depending upon the predicate).

Right now, the standard doesn't require evaluating all of MERGE's
arguments, but it also doesn't prohibit evaluating the one that ends up
not being used.  That makes MERGE less useful than it could be as a
substitute for conditional expressions.  For example, you can't count on

  x = merge(y,0,present(y))


Jim's customer wants to count on


not working when a == 0.  Why would you want that not to work?  I would
much prefer that it be guaranteed to work, rather than that it work or
not work at the compiler's whim.

> Cheers,

More information about the J3 mailing list