Function literals and lambda functions

bearophile bearophileHUGS at lycos.com
Sun Mar 6 15:56:23 PST 2011


retard:

> It also generates a bit of redundant code for each template instantiation.
> No solution for this has been proposed afaik.

>From a recent answer, I think Walter hopes in a magic solution for this bunch of problems.

In past I have shown some possible attacks against this bunch of problems:
http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=108136
http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=108275

My theory is that you can't ask the compiler to magically solve this problem, or to produce a ton of templates and them remove most of them and most of the code duplication. A more practical approach is probably needed, and this means using several different ideas to avoid creating templates, etc. One idea:
http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=126655


>  It's a deal breaker in embedded programming.

Don't worry, I don't see people using D for embedded programming soon. D is not designed for this purposes. Today there are no good languages for embedded programming. C is used out of desperation because there is almost nothing else for it. On the other hand "embedded programming" is slowly changing, the available RAM is growing and sometimes even 32 bit CPUs are used (but smaller CPUs are hugely more common still).

Thank you retard.

Bye,
bearophile


More information about the Digitalmars-d mailing list