http://d.puremagic.com/issues/show_bug.cgi?id=6094


Rob Jacques <sandf...@jhu.edu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|enhancement                 |regression


--- Comment #10 from Rob Jacques <sandf...@jhu.edu> 2011-06-29 23:53:43 PDT ---
(In reply to comment #9)
> (In reply to comment #8)
> > I'm pretty sure this is a regression between DMD 2.052 and DMD 2.053. I 
> > found
> > this 'regression' in template constraints:
> > 
> > if( isPointer!T && isPointer!(pointerTarget!T) )
> > 
> > the problem is that if T is a string, then pointerTarget!T can not compile.
> > This wouldn't be an issue if that meant the template constraint failed
> > gracefully, but instead it halts compilation.
> 
> No, that's not a regression. && was never defined to work in that way.
> It's a Phobos bug which has been exposed.

Don, this compiled prior to DMD 2.053 and was in my code, not Phobos. It _is_ a
change from existing behavior. (Whether that change is a bug fix or a
regression is debatable)

> > Anyways, there is the question of whether or not shortcutting is the correct
> > behavior.
> > 
> > From a performance point of view, as someone who has spent time optimizing
> > templates for compile times, anything that can reduce DMD's memory-usage or
> > compile times is a good thing.
> >
> > From a practical point of view, being able to guard statements without 
> > using a
> > static if is great for template constraints and other short templates.
> > 
> > From a consistently point of view CTFE is already shortcutting everything
> > inside a if(!__ctfe){} block. (and probably other if(false){} blocks as 
> > well).
> > And we will never be able give up shortcutting if(!__ctfe){} blocks.
> 
> That is COMPLETELY irrelevant. It has nothing in common. To repeat what I said
> earlier: the constant folding behaviour of && does *not* involve CTFE. In 
> fact,
> it's not even a change to the constant folding; it's a change to the semantic
> pass of &&.
> 
> What this request is: Given X && Y, if X always evaluates to false, do not
> perform _any_ semantic analysis on Y. No matter what garbage it is.
> Likewise for X || Y; if X is true, don't semantically analyse Y.
> 
> So, instead of 
>  1. semantic analysis X and Y;
>  2. constant fold X&&Y;
> it would become:
>  1. semantic X;
>  2. constfold X;
>  3. if (X is true) return true;
>  4. semantic Y;
>  5. constfold X&&Y.
> 
> This is clearly a major enhancement request and not a regression.

Thank you for explaining the situation. I had thought that the change in
behavior was due to CTFE being applied in more places and replacing the
existing constant folding, etc. Given that this isn't related to CTFE, then
this is definitely a regression, as DMD 2.052 constfolded X before semantic
analysis of Y. (at least inside of template constraints and the like)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to