Test for array literal arguments?

bearophile bearophileHUGS at lycos.com
Tue Jun 5 18:44:24 PDT 2012


Peter Alexander:

> One problem with this approach is that it only solves some 
> cases and cannot work in general.

The general solution is named "Partial compilation", it's a mess 
and probably you don't want it in the DMD compiler (despite it 
seems LLVM is getting able to do it a bit). Yet lot of people are 
studying partial compilation for 20+ years or more, because it's 
very interesting and potentially useful.


> - Adds more rules for overload resolution.

This needs to be studied. But keep in mind that Walter has 
already tried and refused that idea of "static" arguments. So you 
can't assume it's an easy thing to implement.
Here we are discussing just about the second part of my post. The 
title of my post refers to just the first half of it.


> However, the biggest problem with this proposal (in my opinion) 
> is that it is unnecessary. I care deeply about performance, but 
> tiny optimisations like this are simply not important 99% of 
> the time. When they are important, just write a specific 
> optimised version and use that. Yes, you lose generality, but 
> special needs call for special cases. Let's not complicate the 
> language and bloat the codebase further for questionable gain.

Writing specialized versions without any language help is not 
nice, and I think the gain is significant, it's not just tiny 
optimizations. My D programs contain lot of stuff known at 
compile-time. I think such simple poor's man hand-made version of 
partial compilation is able to do things like (done by true 
partial compilation):

http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.31.5469&rep=rep1&type=pdf

Bye,
bearophile


More information about the Digitalmars-d mailing list