On Monday, 24 September 2012 at 07:00:37 UTC, monarch_dodra wrote:
On Sunday, 23 September 2012 at 21:44:20 UTC, comco wrote:
[SNIP]
Now we can implement our rotate in terms of reassign:
void rotate(node* u) {
auto v = u.right;
reassign(u.right, v.left, u);
}
This works and is general enough, but notice the duplication
of u.right. I don't like it - this may become an arbitrary
large expression.
[SNIP]
void rotate(node* u) {
node* v;
mixin ReassignMixin!(v, u.right, v.left, u);
reassign();
}
See how the client code looks nicer when the template
arguments are not wrapped as strings.
I just don't see neither the problem, nor how the proposed
solution is any better.
All I see is a clean, closed and finished rotate at first, and
then... something else...
Relate:
BR 8718 I just filed:
Template mixin + string mixin name collision
http://d.puremagic.com/issues/show_bug.cgi?id=8718
Yes, I don't claim that - the last thing is just nasty. It's just
playing with constructs seeing how far can we go. By the way, now
I use the reassign function all over the place! I'm also very
glad this discussion ends with a (remotely connected) bug report!