lua-users home
lua-l archive

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


Alexander Gladysh wrote:
On Tue, Nov 25, 2008 at 9:54 PM, KHMan <...> wrote:
Wim Couwenberg wrote:
I just think that chain()()()()()() is not real-world,
It is, like it or not, a very common idiom in the boost "assign"
library for C++.  Chains of tens of calls are no exception.  It is
interesting (and surprising) to see what code it generates...
Thanks for the info, I got boost downloaded somewhere and I'll go study it.
Guess I haven't seen too many lines of C++.

Anyway, for those who want to look:

http://www.google.com/codesearch?hl=en&lr=&q=%22()()()%22&sbtn=Search

Given the above search string, there were no valid examples for C, a few for
C++.

I meant chaining function calls with arguments of course. I just
excluded arguments from the benchmark for brevity. I apologize for the
confusion. Next time I'd try to come up with some motivation for the
benchmarks I post.

Well, it's just a discussion that went off on a tangent from benchmark results; there is no right or wrong. :-) I look at them as microbenchmarks anyway.

If we follow the example of the boost's assign library, then chain()()() can be a valid pattern in Lua, if one chooses to use such a pattern, e.g. chain(123)()()("foo")("bar").

Trying to gauge the popularity of this pattern, I tried searching for boost's "ptr_insert(" and turned up zero examples... so, /caveat emptor/ then. I'll say no more. :-)

--
Cheers,
Kein-Hong Man (esq.)
Kuala Lumpur, Malaysia