Is anyone here using Loki?

  • Thread starter Thread starter Ray
  • Start date Start date
R

Ray

I am reading Andrei Alexandrescu's book. The ideas presented there sound
really good, but I wonder--is there really a lot of people using it? Or
it's simply too esoteric for mortals?

Cheers
Ray
 
Ray said:
I am reading Andrei Alexandrescu's book. The ideas presented there sound
really good, but I wonder--is there really a lot of people using it? Or
it's simply too esoteric for mortals?
I'm not sure what exactly you mean with Loki, but I take it you mean
the Template Metaprogramming stuff (after all I have seen many
specialized small object allocators in a lot of real-world apps).

I don't use Loki (anymore) because Boost (MPL, Tuple, Fusion ...)
provides better solutions. I think these are especially useful for
library implementers. But then, creating the appropriate abstraction
_should_ be important for application developers, too.

That said, I agree, for many programmers using C++ today,
template metaprogramming techniques are too complicated --
sometimes I think even pointers are... oh well ...

-hg
 
Hi Ray!

Loki, as far as I know, is Boost's predecessor. IMHO, Boost is a great and
maybe someday part of it will make it to the standard library. You should
take a look at http://www.boost.org/doc/html/who_s_using_boost_.html

On the other hand, I am by no chance an expert, but I've been using it for a
couple of months and I'm already addicted to it.

Cheers,

Carlos
 
Carlos said:
Hi Ray!

Loki, as far as I know, is Boost's predecessor.

Actually, Boost predates Loki by several years. Some of the techniques
exemplified in Loki could eb considered predecessors to some of the newer
parts of Boost, but there's really not a parent/child relationshop there.

-cd
 
Ray said:
I am reading Andrei Alexandrescu's book. The ideas presented there sound
really good, but I wonder--is there really a lot of people using it? Or
it's simply too esoteric for mortals?

I do use some parts of Loki : the fixed size allocator, the singleton helper
(modified not tu use the double locking pattern), the abstract factory and a
few others. I must admit I haven't found (yet) a real-world usefullness to
typelists and the like. Concerning type-traits, I'd rather use Boost.

Arnaud
MVP - VC
 
Holger Grund said:
I'm not sure what exactly you mean with Loki ...

Loki is the name of the library that Andrei describes in the book. It's a
actual, specific, library that you can download from the book's website or
from SourceForge.

http://sourceforge.net/projects/loki-lib/
I don't use Loki (anymore) because Boost (MPL, Tuple, Fusion ...)
provides better solutions.

I think Andrei's stuff is (or was when the book was published) rather more
bleeding-edge than the code in Boost. Andrei's work is significant because
he pushed forward the boundaries of what can be done with the
metaprogramming capabilities of C++'s template language further than anyone
else had done (some would say he misused those facilities more flagrantly
than anyone else had done).

Other libraries, including Boost, had used metaprogramming techiques before
Loki, but none had pushed the boundaries as far.

I'm not sure that I'd recommend the use of Loki in production code because
it stresses the compiler really quite hard, and that severely limits
portability. Boost does this too, but to a lesser extent.
That said, I agree, for many programmers using C++ today,
template metaprogramming techniques are too complicated --

I've heard David Abrahams say that TMP is for library implementors more
than it is for application programmers. There's some truth in that.

Cheers,
Daniel.
 
Daniel James said:
[...]
I think Andrei's stuff is (or was when the book was published) rather more
bleeding-edge than the code in Boost. Andrei's work is significant because
he pushed forward the boundaries of what can be done with the
metaprogramming capabilities of C++'s template language further than anyone
else had done [...].

Have you read Czarnecki/Eisenecker?
(www.amazon.com/exec/obidos/ASIN/0201309777)
[...]
Daniel.

Schobi

--
(e-mail address removed) is never read
I'm Schobi at suespammers dot org

"The sarcasm is mightier than the sword."
Eric Jarvis
 
Daniel said:
Loki is the name of the library that Andrei describes in the book. It's a
actual, specific, library that you can download from the book's website or
from SourceForge.

http://sourceforge.net/projects/loki-lib/


I think Andrei's stuff is (or was when the book was published) rather more
bleeding-edge than the code in Boost.

It certainly isn't any more. Have you seen the boost template and
preprocessor metaprogramming libraries? And boost.lambda and boost.spirit?

Andrei's work is significant because
he pushed forward the boundaries of what can be done with the
metaprogramming capabilities of C++'s template language further than anyone
else had done (some would say he misused those facilities more flagrantly
than anyone else had done).

It's rather that he was the first to apply template metaprogramming
techniques to the implementation of design patterns.
Other libraries, including Boost, had used metaprogramming techiques before
Loki, but none had pushed the boundaries as far.

I'm not sure that I'd recommend the use of Loki in production code because
it stresses the compiler really quite hard, and that severely limits
portability. Boost does this too, but to a lesser extent.

Boost is much worse, but it has a lot more people working on making it
compatible with a large number of compilers.

Tom
 
Daniel James said:
No. I've seen it but not read it.

You're right that it predates /Modern C++ Design/ by a year ... but -- from
what I've seen -- I don't think it's quite as off-the-wall as Andrei's
work. I'll have to take another look ...

They have a chapter about TMP where they develop (IIRC)
compile-time lists, if, switch, loops etc. ISTR postings
by Dave Abrahams in the boost mailing list when he read
it. It's probably been been a major influence for boost's
TMP libs.

Schobi

--
(e-mail address removed) is never read
I'm Schobi at suespammers dot org

"The sarcasm is mightier than the sword."
Eric Jarvis
 
Arnaud Debaene said:
I do use some parts of Loki : the fixed size allocator, the singleton helper
(modified not tu use the double locking pattern), the abstract factory and a
few others. I must admit I haven't found (yet) a real-world usefullness to
typelists and the like. Concerning type-traits, I'd rather use Boost.

I have a piece of cake^Wcode that builds type lists of
function arguments by function signatures. These are
used for checking parameter syntax when parsing config
files.
I also use them in my logging lib. You pass a severity
when you want to log something. You can set up log
targets that log specific severities. Severities are
compile-time thingies (so log statements can be
filtered at compile-time and thus compiled out). If
you need to pass several of them around, typelists are
used.
I also have a derivator that inherites from a list of
types. A quick grep couldn't find any place I use this
right now, but obviously I needed it ones.
And then I have code that manages objects of several
types which have parent-child relationships. They each
have one parent type and any number of child types.
(For each child type, an object can reference any
number of child objects.) Many operations on them are
applied recursive. So there's a lot of TMP stuff that
figures out which child types the object's type has
and for all child types recurses down into the child
objects. An object's type definition contains a list
of child types and that's a typelist, too.

I don't use loki, though.

Schobi

--
(e-mail address removed) is never read
I'm Schobi at suespammers dot org

"The sarcasm is mightier than the sword."
Eric Jarvis
 
Back
Top