« first day (270 days earlier)      last day (4693 days later) » 

10:28 PM
I just noticed there's a new version of Boost out
 
I haven't kept up with the newsgroups this days :(
I'm glad Phoenix 3 made it.
 
What's the difference between Phoenix and Proto?
 
Amazing, asio has move support!
 
(And who would need either? ;-) )
ASIO improvements look very promising
 
Proto allows one to design EDSLs.
Phoenix is an EDSL.
 
10:39 PM
So... why not do away with Phoenix and ship it as an example application of Proto?
 
It's slated to eventually replace Boost.Lambda
For the time being, they coexist however.
> Pre-preprocessed for better compile times.
For Proto
This made me smile.
 
Ah, I forgot about boost.lambda. Is any of this still relevant in C++0x?
I wish there'd be a new Boost 2.0 based on C++0x which throws out everything that's now in the standard.
 
yes
 
Yes.
 
the lambda stuff is irrelevant in so far as that you want to create C++ functions
but if you want to create DSL functions or data, there's nothing new for it in C++0x
 
10:51 PM
What's a convincing usage example for any of {lambda, proto, phoenix}?
Parsing?
 
std::transform(begin0, end0, begin1, out, arg1 + arg2); is more concise than a lambda and is polymorphic.
i.e. I can do auto transform = arg1 + arg2; f(transform); g(transform); even if f and g operate on containers of unrelated types.
 
Hm, I see. Indeed. Do I get to use that out of the box just by including a header?
 
I'm not familiar enough but this is usually the case.
 
Interesting.
 
When I can't be bothered to look up the docs I simply go #include <boost/some_lib/some_lib.hpp>
 
10:55 PM
I imagine this screams precompiled headers!
 
For Proto it's to be used in very specific case.
I have yet to stumble on a need for an EDSL.
I thought I could do interesting stuff with std::future but it turns out it's not that powerful.
 
Indeed, hence my question. It's all very nice and exciting that it can be done, but... does it need to be done?
 
Proto? Are you kidding?
 
SQL is the main obvious use for DSLs
 
You mean SQL directly in C++?
 
10:57 PM
preferably expressed, rather than as string literals
something like
 
(I'm serious, I don't know of any applications for Proto, but I am just very ignorant on that subject. I'd be keen to see any real-world application of it.)
 
I haven't even looked at Proto :P
 
@KerrekSB The EDSL that I have used the most is the one from luabind, which looks like module(L)[ class_<T>("T").def(&T::a_member, "a_member", ...), class_<U>("U")... ] (it looks neater on several lines).
AFAIK It was not designed with Proto but if I were to design a EDSL I feel relieved knowing someone has done some of the heavy lifting.
It has the neat property that it separates the syntax (grammar/expression template stuff) from the semantics (the actions).
This is always desirable for what is in essence parsing/lexing.
 
So what does this give me -- lua functions composed of C++ objects?
 
Lua code can now use the types you registered: local t = T() t:a_member()
It's inspired from Boost.Python I believe.
 
11:07 PM
Ohh. That's fairly nice.... I guess. I tried and failed once with luabind, so I don't remember how difficult it was to register functions and variables "by hand".
 
you don't want to know
the Lua C API is hideous, and disgusting, and I've been scarred for life trying to use it
 
Ah, here it is. Yes, I didn't want to know. My code was in an old git branch.
I'm still shocked at the amount of C code one has to write even with luabind. I was hoping there'd be a nice, clean C++ wrapper.
So are you saying that with Proto I can integrate Lua easily?
 
I don't usually write C code with Luabind.
@KerrekSB No, I'm saying that this particular feature of luabind can be written via Proto.
 
I see
 
This feature is an example of an EDSL and so is Phoenix.
 
11:11 PM
Hm. OK, I'll keep that in mind...
Yeah.
So when you need to register lots of functions for Lua, it may be worth setting up the EDSL to do it cleanly and safely?
 
Also what I wanted to do with future was something like auto f = std::async(...); auto g = std::async(...); auto h = f + g; auto res = h.get();
@KerrekSB If it's just functions (i.e. LUA_CFUNCTION) there may be simpler alternatives.
 
you mean h.get()?
 
Turned out I had no idea what the exact semantics should be so I gave up on that (i.e. the notation is nice but I essentially expected magic to happen).
 
It would appear to be magic... well, you'd want get invoked on both sides I guess. So the lazy object +(-,-) should automagically inherit all methods of either operand?
It's pure insanity, but I guess it'd look pretty impressive at dinner parties.
 
The problem is: where and when is the f.get() + g.get() computation done? Synchronously in the calling thread? Asynchronously with a call to std::async? Asynchronously on a thread pool? For the last one, how do I guarantee that any computation is lock-free?
 
11:21 PM
Hmm. Can't one build a template template <typename T> struct LazyPlus : public T { ... }; somehow?
Should be same as { auto a = f.get(), b = g.get(); return a+b; }.
 
And where and when? :)
 
Sequentially in the calling thread.
there's no magic in get().
 
I thought as much. The two others are killer features but requires extensive work/tuning and are more of an optimization or project in and of themselves.
 
Wait, we need to defer. Only 40min left, and I should try to rack up some rep.
 
But if what remains is synchronous code I might as well write auto res = f.get() + g.get(); outright.
 
11:23 PM
Yes
 
So that's just what I do.
 
Oh, did you mean the lazy expression to be somehow more powerful?
But how - you need to wait for both futures to finish no matter what.
 
Yeah. It's interesting when/if the + is expensive.
Imagine a generalized case for op(f.get(), g.get()) where op is potentially expensive enough that's it's interesting to compute is asynchronously and f and g are dependencies.
 
You mean op could be doing work already with only one or even none of its arguments?
 
if I write
auto f = ...; auto g = ...; auto h = f + g; /* yay */ h.get();
whatever is in /* yay */ is concurrent to op.
 
11:36 PM
I see - hm, that could just be wrapped into a some lazy-evaluation class, couldn't it?
At least if you always mean to say .get().
 
Well, the point of the exercise is to have lazy futures indeed.
 
11:53 PM
Have you built one already?
Are they all of type std::async?
 
I haven't.
I used std::async as a shorthand for 'I get a future'.
Realistically though I wouldn't be using std::future but a custom type.
 
OK: template <typename T, template<typename A, B> class Op> class LazyOp { LazyOp(T & x, T & y) : x(x), y(y) {} RetVal get() { return Op(x.get(), y.get()); } }:
Something like that, with various types to be figured out
 

« first day (270 days earlier)      last day (4693 days later) »