lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Wed, Feb 16, 2011 at 1:04 PM, T T <t34www@googlemail.com> wrote:
> of code I would like to write or work with.  One would hope that such
> a (common?) case as unrolling small loops could be done automatically
> for the programmer, rather than require writing special templating
> solutions.

One issue is that we do not have this:

const n = 3

With that kind of guarantee, unrolling becomes possible. (I'm sure we
don't want to return to code full of magic numbers!)

One approach to this is to use an integrated preprocessor that uses
the token-filter patch. That would make our 'n' to be a macro which is
expanded as '3' wherever used.

But the situation that Francesco is dealing with is template
specialization, as a C++ programmer would understand it.  That
requires re-compiling different cases.

What is probably needed is a more sophisticated template expander
that's less hard on the eyes...

steve d.