A Class in Composition
Chris
wendlec at tcd.ie
Thu Aug 29 02:13:10 PDT 2013
On Wednesday, 28 August 2013 at 18:30:11 UTC, H. S. Teoh wrote:
> As for overheads, I wonder if, given enough experience over
> time, we can
> one day identify common patterns that the compiler can take
> advantage of
> and optimize into more efficient code. For example, if the
> compiler
> recognizes a linear composition of range-based components, it
> could
> transform them into optimized nested loops that eliminate some
> of the
> overhead involved. I'm not sure how feasible this is with the
> current
> DMD implementation, though. But it's certainly something to
> keep in mind
> for the future.
>
Thanks for your comments. I was thinking the same thing, i.e.
that maybe future implementations of the compiler can optimize
the overhead away. If CP is THE major thing in D (and it makes
perfect sense that it is), then the compiler (and syntax) will
adapt to it over time, I guess (and hope).
I'll try to introduce CP/Ranges where ever it makes sense from
now on. It was unbelievable how well the code worked once I could
free myself from the loop. And I can take the components and use
them "as is" in a separate program I use to add entries to the
lexicon source files. I'm only wondering how to integrate the new
pattern properly into an otherwise OO framwork. I seriously
wonder whether CP/Ranges will make OO obsolete. After all,
structs are "classy".
More information about the Digitalmars-d
mailing list