On Monday, 15 August 2016 at 14:40:14 UTC, Chris Wright wrote:
On Mon, 15 Aug 2016 06:43:11 +0000, ZombineDev wrote:
Well, I guess it would hard for me to convince you if you
don't know what Design by Introspection means.
Some years ago I was on #d on freenode and someone made a
reference to high-order functions. I hadn't encountered the
term, so I asked about it. The person answered that if I didn't
know what it meant, I must not use high-order functions.
In point of fact I was making moderate use of high-order
functions at that time, but I hadn't heard that term for it.
There is a difference between knowing how to do a thing and
knowing a specific term for that thing.
Sorry, I didn't mean my post to sound that way. From my
experience of trying to explain DbI to a couple of friends, it's
a hard to appreciate the paradigm if you're not already using it
casually, and so it would be even harder for me to make a case
for why it makes C++ concepts / Rust traits much less useful than
they're advertised to be.
The classic example would be walkLength [1]. However that example
does not make a good case because it could also be implemented
with overloading or dynamic casts (albeit at the cost of
inflexibility and/or runtime pessimization) in other languages
like C++ and C#. Personally, I really like things like Seb's
recent work on attribute propagation for
std.experimental.allocator.make and makeArray [2][3][4], but I'm
not sure if that's an example a beginner would appreciate.
[1]:
https://github.com/dlang/phobos/blob/v2.071.2-b2/std/range/primitives.d#L1577
[2]: https://github.com/dlang/phobos/pull/4680/files
[3]: https://github.com/dlang/phobos/pull/4682/files
[4]: https://github.com/dlang/phobos/pull/4683/files