September 15, 2008
That might be the case that you have to specify programmaticly right now but I still think it would be useful if there was a way to determine this since somethings could be automated, making it easier for programmers and on large calculations this could speed things up significantly if being used with mixins to optimize structures.
September 15, 2008
bmeck wrote:
> That might be the case that you have to specify programmaticly right now but I still think it would be useful if there was a way to determine this since somethings could be automated, making it easier for programmers and on large calculations this could speed things up significantly if being used with mixins to optimize structures.

You'll get no argument from me there.  I'm a big fan of static analysis, although IMHO it would make more sense in a separate tool, rather than the compiler.

Also, in any static analysis, you have to answer the (difficult) question of: "Is this analysis worth the cost?  Would it be faster to just compile and run it?"  That's always a hard one, and as a general rule, it's unanswerable...by the time that you are certain which path would be faster, you have already paid the cost of analysis. :(

It's a thing worth considering, though.
September 15, 2008
Im not arguing that we should enforce this, just allow a static if and for some things like gui driven programs that may use Regex a lot or physics applications where large math problems can occur in somewhat repetitive order it would make things a bit easier to manage if I could tell the compiler if you have this at compile time, do it. I don't see why repetitive hard coded values would be a problem, but as you said the price of analysis is a problem at many times especially when you could be using pointers and your ctfe gets thrown away almost immediately. The current state of the compiler has no option for this static analysis but I do believe it should give the opportunity to have a tool built onto it (D's CTFE is plenty if you could get a static if working to see if params are available at compiletime) for such a thing. I hate the use of multiple programs since you almost always end up writing a script to combine them anyway, just give the thing an external API and good riddance :P.
1 2
Next ›   Last »