bearophile wrote:
Writing working asm is much simpler than...
Ya I've actually written ASM GPU shaders in the past. Not the
same instruction set as x86 or anything, but I know the basic
concept.
Though, there *could* be area for automatic optimization here,
right?
Currently DMD devs are mostly trying to fix bugs, instead of
adding optimizations.
And as the pure attribute it's not just a matter of
optimization. It's a contract between programmer and compiler.
If you add "static" and then you use a variable in the
enclosing function, you receive a compilation error. This error
can't happen if "static-ness" is just an invisible automatic
compiler optimization. It's good for such errors to come out,
because when you use static you are stating you don't want to
use outer function variables. So this is both a guaranteed
optimization and a way to avoid using by mistake a variable
defined in the enclosing scope. Using unwillingly variables
from the outer scopes is a common source of bugs.
Well, my point wasn't that any function could receive "static" or
purity implicitly, only nested ones. Seeing as how their use
scope is very limited.