On Sunday, 14 August 2016 at 18:17:58 UTC, Enamex wrote:
On Sunday, 14 August 2016 at 18:05:12 UTC, ZombineDev wrote:
[...]
OTOH, they're used in more places in their standard library,
than mixins are used in Phobos, because of the lack of
variadic templates, because in Rust you can't generalize over
mutability, like you can in D with `inout` and also because of
the stupidly designed trait system (e.g. see [9]).
I'm confused by your example. How exactly is Rust's trait
system 'stupidly designed'?
Ok, maybe it's a matter of taste and opinion, but I consider them
to be bad design (idea-wise, not implementation-wise) because
they're sort of the opposite of DbI and compile-time duck-typing.
Maybe they fit nicely in Rust's world but they're definitely
something I would want NOT to use. Concepts/traits are useless
when you have DbI, because you can implement them in a library if
you need dynamic dispatch (e.g. std.range.InputRangeObject,
std.experimental.allocator.allocatorObject, std.typecons.wrap,
etc.).
[...]
From my understanding of Rust macros, they're kind of like the
AliasSeq algorithms in std.meta (because they're declarative),
but instead of operating on sequences (e.g. template arguments
lists) they operate on Rust's AST (e.g. statements and
expressions).
The AliasSeq algorithms are defined recursively for obvious
reasons, but they rely on branching and a lot of obviously not
declarative code in their definition. :?
and a lot of obviously not declarative code
Like what?
They're definitely not imperative (e.g. in-place mutation is not
possible), so I consider them to be declarative. The fact you can
call any imperative D function at CT as the conditional
expression is just a nice coincidence.
[...]
[9]:
https://github.com/rust-lang/rust/blob/master/src/libcore/slice.rs#L804