[rust-dev] "Virtual fn" is a bad idea

Patrick Walton pcwalton at mozilla.com
Wed Mar 12 13:49:42 PDT 2014


On 3/12/14 12:33 PM, Daniel Micay wrote:
> Rust is already a large language, and the interactions between many of
> the features are subtle or poorly defined.

Citation? Like what?

> There's a complexity cost for
> every feature that's added. It gets harder for a single programmer to
> learn the language and makes it less feasible for even an experienced
> Rust programmer to grasp it all. The compiler will have more bugs, so
> the safety guarantee won't be as strong.
>
> Variadic generics, optional/keyword parameters, higher-kinded types,
> single inheritance, refinement types, dynamically sized types,
> compile-time function evaluation, generic literals and more are all
> proposed as useful features. I think there's the potential for Rust to
> be a more complex language than C++, if it's not already.

Rust is not a more complex language than C++. That's hyperbolic. Today 
we don't have single inheritance, templates without concepts, the 
preprocessor, the implicit numeric coercions, implicit pointer 
coercions, overloadable coercions, argument-dependent lookup, non-type 
template parameters, volatile, constexpr, rvalue references, 
constructors (including `explicit`), runtime type information, 
allocators, capture clauses, copy constructors, many overloaded 
operators (e.g. assignment), `->` syntax, the lexer hack, multiple 
inheritance, pointer-to-member-functions, the subtle rules around 
"const", "protected", "goto", the SFINAE rule, the implicit `this` 
pointer and the `enable_shared_from_this` that you need, `const` member 
functions, the `mutable` keyword, the ternary operator, `nullptr`, 
default arguments, friends, exceptions, variable-length arrays, 
preincrement/postincrement operators, the `sizeof` keyword, custom 
braced initializer syntax, the C-style `for` syntax, constructor 
initializer lists, `static` variables, and unnamed namespaces. Just to 
name a few.

Without single inheritance, how do you solve the problems outlined in 
this thread?

Patrick



More information about the Rust-dev mailing list