digitalmars.D - Some dynamic dispatch to reduce template bloat
- bearophile (7/7) Jan 22 2013 This "Dynamic dispatch" section of the Clay language
- mist (6/14) Jan 22 2013 May be I do not get it, but this can already be done in D. There
- bearophile (9/12) Jan 22 2013 Of course. But that link is a starting point to invent a possible
- mist (5/5) Jan 22 2013 What syntax sugar do you propose? There is hardly anything in the
- bearophile (8/9) Jan 22 2013 Maybe some tagging to denote what template arguments should be
- mist (4/13) Jan 22 2013 So far not convincing, do not see a lot of added value for new
This "Dynamic dispatch" section of the Clay language documentation shows a way to avoid some template bloat (that is common in Clay): https://github.com/jckarter/clay/wiki/Avoiding-generic-programming-pitfalls Maybe it's possible to make that syntax&code shorter and lighter. Bye, bearophile
Jan 22 2013
On Tuesday, 22 January 2013 at 11:09:05 UTC, bearophile wrote:This "Dynamic dispatch" section of the Clay language documentation shows a way to avoid some template bloat (that is common in Clay): https://github.com/jckarter/clay/wiki/Avoiding-generic-programming-pitfalls Maybe it's possible to make that syntax&code shorter and lighter. Bye, bearophileMay be I do not get it, but this can already be done in D. There is always a trade-off between template binary bloat and performance penalty of dynamic typing and suggested approach (make a templated light interface and code most function using dynamic typing) is not that uncommon one even in C++ world.
Jan 22 2013
mist:this can already be done in D.Of course. But that link is a starting point to invent a possible syntax sugar. Sometimes some sugar makes the difference from nearly never using a feature, and using it when it's useful.There is always a trade-off between template binary bloat and performance penalty of dynamic typingRight. A flexible language allows you to chose case by case (with a default, when you don't care). Bye, bearophile
Jan 22 2013
What syntax sugar do you propose? There is hardly anything in the link that can't be done with current std.variant.Algebraic at first glance. Only stuff I can think of is some convenient way to retrieve strongly typed value from Algebraic back, but that is library update, nothing to do about language syntax.
Jan 22 2013
mist:What syntax sugar do you propose?Maybe some tagging to denote what template arguments should be autoboxed? The last piece of code in that page shows two saveClient() functions. Maybe only one of them is needed, and the other can be auto-generated. Bye, bearophile
Jan 22 2013
On Tuesday, 22 January 2013 at 14:39:58 UTC, bearophile wrote:mist:So far not convincing, do not see a lot of added value for new syntax :) Thanks for your explanations anyway.What syntax sugar do you propose?Maybe some tagging to denote what template arguments should be autoboxed? The last piece of code in that page shows two saveClient() functions. Maybe only one of them is needed, and the other can be auto-generated. Bye, bearophile
Jan 22 2013