5 ms·
Why does this post need to appear any time C++ is a topic? Do you learn and use all of any language you use?
by creato 6y ago
Why does this post need to appear any time C++ is a topic? Do you learn and use all of any language you use?
- pjmlp 6y agoBecause there is this urban myth that other languages aren't as complex, yet drop someone with a beginners loved language like Python 3.8 and they will have fun throughout the almost 2000 pages of documentation plus all major libraries in use across the ecosystem, and Python implementations.
- tylerhou 6y agoOther languages are definitely less complex — you generally don’t see language lawyering for Python or Java — but I think that there are many useful features in C++14/17/20 as well. Writing only C++11 will lead to suboptimal code.
- jcelerier 6y ago> you generally don’t see language lawyering for Python or Java But my experience for instance when having to do stuff in C#, Java or Python is that when I'm looking for advice on the internet, stackoverflow, etc etc... 80% is reaaalllly bad, in the sense that if it were C++ everybody would be screaming "wtf don't do that this is insane" and write 12 blog posts and 40 twitter flamewars about why this is a bad idea and you should never ever do this... but apparently the "tolerance to bad code" is much higher in other communities.
- tylerhou 6y agoOne way Herb Sutter looks at it is — most advanced programmers could probably write a Python or a Java interpreter. It might take them a few years, and they might struggle with some complex language features like metaclasses, reflection, or the type system, but the language spec is understandable enough that it’s feasible. But give them five years and they would generally not be able to write a C++ compiler.
- dtech 6y agoThis is a side effect of those languages being much more accessible to beginners and more widely used than C++. You won't find that as much for for Haskell or Clojure or Brainfuck but that doesn't make them better languages or less tolerant to bad code.
- bartwe 6y agoBeing more accessible means being usable by less trained/skilled developers, which makes online communities less trained/skilled on average. I wouldn't use that as an argument to prefer to use worse tools and their built-in 'you must be this tall the ride' nature.
- hackingthenews 6y agoThe problem is not just complexity, but complexity with tons of pitfalls.
- pjmlp 6y agoThere are plenty of opportunities for a Python Puzzles quiz.
- dtech 6y agoAre you seriously arguing Python has about the same complexity as C++? An extensive standard library is not the same at all as an large base language size. Adding a million books to a language doesn't make it more complex, adding a million words and verb conjugations does.
- pjmlp 6y agoYes I am, Python even changes stuff between minor releases. Also I think many aren't aware how powerful Python actually is.
- shaklee3 6y agoTotally agree. Look at something like asyncio and how many things have been improved or deprecated since 3.5. it makes it really hard to keep up. Sure, if you want to stick to basic python it's certainly easier to learn than C++, but the language as a whole isn't much simpler
- gpderetta 6y agoI have spent quite a bit of time invstigating the metaprogramming capabilities of python and I have barely scratched the surface. And I hear they have added a fully parametric type system recently...
- ben509 6y agoIt's parametric, sure. It's not "full" in that it can't express the types of many language features well enough that inference works. Something like the attrs package needs to use a kludge[1] to communicate types back to a validator. https://github.com/python-attrs/attrs/blob/4f74fbaca3cc12911e4dcf67a5cc9d2465c3e571/src/attr/__init__.pyi#L100 https://github.com/python-attrs/attrs/blob/4f74fbaca3cc12911...
- dragonwriter 6y ago> yet drop someone with a beginners loved language like Python 3.8 and they will have fun throughout the almost 2000 pages of documentation plus all major libraries in use across the ecosystem, and Python implementations. I would agree that the Python ecosystem is as complex as the C++ language. I would not agree that the Python language is as complex as the C++ language, or that they Python ecosystem is as complex as the C++ ecosystem. I will agree also that the Python language has very comprehensive first-party tutorial and reference documentation, but that doesn't add to the complexity.
- pjmlp 6y agoThen it is time to learn some clever use of Python metaprogramming, metaclasses, how slots interact with old style attributes, old and new style classes, clever tricks with magical methods, stackless vs regular Python, multiple ways to format strings, arithmetic semantic changes,...
- uryga 6y ago> old style attributes, old and new style classes pretty sure that's only a factor if you need to deal with Python 2
- pjmlp 6y agoI expect any Developer X, to comfortably understand a random codebase of language X.
- dragonwriter 6y agoI was aware of all those things when I made the original statement, thank you.
- deleted 6y ago[deleted]
- shaklee3 6y agoI think the two major c++ documentation websites are far better than the official Python documentation. They have more examples, the different variants are clear across which version of the language you are using, and I never need to go elsewhere. Python documentation is typically lacking many of the examples you'd really want, and you need to go elsewhere to find those.
- morelisp 6y ago> Do you learn and use all of any language you use? Generally, yes for Python (definitely for 2, async shook up 3 a bit), C (barring a few genuinely legacy things like trigraphs), Go, Lua, and I think probably at least 2-3 times a year for anything in Java 12 and earlier. C++ is the only language I use regularly that I am certain I don't even know of, let alone know or use, all the features of.
- pansa2 6y ago> Do you learn and use all of any language you use? yes for Python Have you really used all of these Python features (from https://twitter.com/raymondh/status/1280988785841278976 https://twitter.com/raymondh/status/1280988785841278976)? __class_getitem__, __init_subclass__, __prepare__, __qualname__, __slots__, __spec__, __annotations__ __subclasshook__, __abstractmethods__, __text_signature__, __index__, __loader__, __mro__ I've been writing Python for years, but I've never even heard of half of them.
- HelloNurse 6y agoBecause they are extension points that all have sensible defaults (in most cases, "nothing to see here") but are readily available when one needs to write something magical, not because there's unnecessary complexity in the language. All Python-like languages have the same or similar mechanisms (for example, a method resolution order whenever there is multiple inheritance) and they are usually not explicit and not customizable.
- sseagull 6y agoBut the common argument against C++ is that you need to know a large portion of the language because someone somewhere might be using it, and you may have to read and understand their code. So even things that are optional in python should count against python, just like they do in C++.
- masklinn 6y agoThe difference is that C++ features very much interact with one another in subtle and detrimental ways, so if you are using feature A and a codebase you leverage uses feature B, the interaction of the two can genuinely cause issues. For Python, the extension points are generally hooks into very explicit operations (and some of the symbols you list aren't even extension points). Hell, the very defaults of C++ will interact badly with other features and proceed to shoot you in the foot, as Chrome somewhat recently reminded us (https://chromium-review.googlesource.com/c/chromium/src/+/1650298 https://chromium-review.googlesource.com/c/chromium/src/+/16...). You need an 8x6 matrix just to know what the compiler will or won't generate (https://i.stack.imgur.com/b2VBV.png https://i.stack.imgur.com/b2VBV.png) and then you need to know exactly what the defaults will do and whether that breaks your object entirely and you need to override those defaults.
- hackingthenews 6y agoKind of ironic that I would agree with you. The reason I still wrote it is that my opinion just recently changed from liking C++ but understanding the pitfalls to a more pragmatic this is not worth the time or effort.