tag:blogger.com,1999:blog-2744072865491516720.post5161400486472943202..comments2023-05-03T06:35:33.259-04:00Comments on Higher Logics: Reusable Ad-Hoc Extensions for .NETSandro Magihttp://www.blogger.com/profile/05446177882449578817noreply@blogger.comBlogger3125tag:blogger.com,1999:blog-2744072865491516720.post-80512613082437376092016-09-06T19:47:35.086-04:002016-09-06T19:47:35.086-04:00Since I was going to add it eventually anyway, I w...Since I was going to add it eventually anyway, I went ahead and did implemented a simple generic visitor for <a href="https://github.com/naasking/Dynamics.NET" rel="nofollow">Dynamics.NET</a>.<br /><br />You can see the intended use there. You can now write parametric functions over any kind of type, and implement custom, extensible functions over those types without having to write wrapper classes and dispatching logic.<br /><br />The generic visitor is as efficient as it can be, and it's only about 100 lines of code.Sandro Magihttps://www.blogger.com/profile/05446177882449578817noreply@blogger.comtag:blogger.com,1999:blog-2744072865491516720.post-7667740398447239972016-09-05T19:16:20.861-04:002016-09-05T19:16:20.861-04:00You can define an ad-hoc visitor interface without...You can define an ad-hoc visitor interface without the type being involved in dispatching, as it is with the visitor pattern. Hence, ad-hoc.<br /><br />So you can define a visitor interface that matches on Int32 and IFormattable, should you ever need such a bizarre pairing, and dispatching to the correct method to handle that case happens for you. This yields comparable extensibility as simple type classes.<br /><br />As I mentioned on reddit, you can even extend this to symmetric multiple dispatch.Sandro Magihttps://www.blogger.com/profile/05446177882449578817noreply@blogger.comtag:blogger.com,1999:blog-2744072865491516720.post-16849657628338149742016-09-05T11:21:10.249-04:002016-09-05T11:21:10.249-04:00I'm not understanding what the purpose or goal...I'm not understanding what the purpose or goal is here.Qwertiehttps://www.blogger.com/profile/04595705428290721343noreply@blogger.com