to share this here.
I think this is short enough to be a good example to show what can be
done with D capabilities.
http://www.deadalnix.me/2012/08/25/visitor-pattern-revisited-in-d/
An issue is that the proposed scheme does not support subclassing a
node to tweak its behaviour without changing
compared to plein old visitor pattern and wanted
to share this here.
I think this is short enough to be a good example to show what can be
done with D capabilities.
http://www.deadalnix.me/2012/08/25/visitor-pattern-revisited-in-d/
An issue is that the proposed scheme does not support subclassing
Le 28/08/2012 00:20, Pragma Tix a écrit :
Am 27.08.2012 17:00, schrieb deadalnix:
auto dispatch(
alias unhandled = function typeof(null)(t) {
throw new Exception(typeid(t).toString() ~ is not supported by visitor
~ typeid(V).toString() ~ .);
}, V, T
)(ref V visitor, T t) if(is(T == class) ||
with a solution which
is a real improvement compared to plein old visitor pattern and wanted
to share this here.
I think this is short enough to be a good example to show what can be
done with D capabilities.
http://www.deadalnix.me/2012/08/25/visitor-pattern-revisited-in-d/
An issue
this is short enough to be a good example to show what can be
done with D capabilities.
http://www.deadalnix.me/2012/08/25/visitor-pattern-revisited-in-d/
On Monday, 27 August 2012 at 15:00:11 UTC, deadalnix wrote:
the fastCast could probably be faster this way (I didn't
checked / compiled)
private U fastCast (U) (object t) {
return cast(U)(cast(void*)t);
}
one less de/reference.
btw, in your implementation should be (is(T == class) ||
visitor pattern and wanted to share this here.
I think this is short enough to be a good example to show what
can be done with D capabilities.
http://www.deadalnix.me/2012/08/25/visitor-pattern-revisited-in-d/
This is nice use of d magic. If the implementation could
recompute the functions
is a real improvement compared to plein old visitor pattern and
wanted to share this here.
I think this is short enough to be a good example to show what can be
done with D capabilities.
http://www.deadalnix.me/2012/08/25/visitor-pattern-revisited-in-d/
This is nice use of d magic
-pattern-revisited-in-d/
This is nice use of d magic. If the implementation could
recompute the
functions pointers during compilation, this seems as nice
generally
function. This makes me thing of computed goto (to functions)
One possibility to achieve this result for visitor is to use
mixin.
I
Am 27.08.2012 17:00, schrieb deadalnix:
I have recently put some effort into exploring alternatives to visitor
pattern and see what can be done in D. I ended up with a solution which
is a real improvement compared to plein old visitor pattern and wanted
to share this here.
Thanks 4 sharing,
10 matches
Mail list logo