4 ms·
I like a lot of things about D, but I don't like the fact that it seems stuck in the OOP fad from 15 or so years ago. Go and Rust have both abandoned this whole
by tree_of_item 10y ago
I like a lot of things about D, but I don't like the fact that it seems stuck in the OOP fad from 15 or so years ago. Go and Rust have both abandoned this whole idea of making "classes" in favor of constructs like structs, enums, traits and interfaces. I wish D had gone this route as well, but other than that it seems like a nice language.
- FraaJad 10y agoEh.. I wrote a 1000 line linux "system" application in D. Didn't use a single class. All enums and structs pretty much like you would approach it like good "C" programmer while still using all of D's goodness.
- tree_of_item 10y agoD enums are not the good kind of enums (i.e. sum types, like in Rust), though. Instead they have some silly implementation of sum types using classes in std.variant.
- Profan 10y agoIt's not a class, it's a struct (as a value type), it's fine if you disagree with the idea of OOP, but don't come in with an incorrect assumption of how the language is actually used in the wild. But sure, I would agree that having a natively implemented variant type would be better, even if this one can serve many of the same purposes. Class = reference type, supports polymorphism, inheritance Struct = value type, does not support polymorphism, inheritance The variant type based on a struct is implemented through the language's metaprogramming facilities.
- zem 10y agothis is my primary "complaint" about D; i strongly prefer languages with algebraic datatypes and pattern matching built in. other than that it does indeed look like a beautiful language. ironically, i haven't really used D for the same reason i haven't really used rust - i've yet to have a project for which ocaml wasn't a better choice. (i know both D and rust address things ocaml doesn't, but they aren't the things i tend to need for my personal projects.)
- skocznymroczny 10y agoYou'll never satisfy everyone I guess. For me personally, I wish D went more the OOP route (as the Tango library did in D1 times), rather than the template/metaprogramming way it went with. Some of the error messages from D rival C++ STL template vomit.
- PeCaN 10y agoHeh, that's exactly what I do like about D—the generic programming/metaprogramming paradigm instead of OOP. You can get some very elegant and efficient code with D, while OOP tends to have more runtime overhead.
- dansze 10y agoI actually almost never use the OOP parts of D because metaprogramming generally offers a more elegant solution to the problem than polymorphism. That doesn't mean there's no downside to the metaprogramming in terms of project complexity, but once you get past the part where you rebuild the universe from scratch it's smooth sailing.
- bachmeier 10y agoI've been using the language since 2013, and I don't think I've ever written a class. My strong preference is functional programming.