this post was submitted on 13 Sep 2024
53 points (94.9% liked)
Programming
17495 readers
88 users here now
Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!
Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.
Hope you enjoy the instance!
Rules
Rules
- Follow the programming.dev instance rules
- Keep content related to programming in some way
- If you're posting long videos try to add in some form of tldr for those who don't want to watch videos
Wormhole
Follow the wormhole through a path of communities [email protected]
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
C++ continues to be the dumping ground of paradigms and language features. This proposal just aims to add even more to an overloaded language.
C++ programmers mocked languages for being dynamically typed then they introduced
auto
, they mocked JS for callback hell and introduced lambdas, they mocked Rust devs for being lowskill C++ devs who can't manage their own memory and now they are admitting they can't manage it themselves either.It's going to be come like the x86 instruction set or windows that is backwards compatible with stuff from 30years ago just accumulating cruft, unable to let go.
Anti Commercial-AI license
auto isn't dynamic typing it's just type inference. It still has a fixed type you just don't have to write it. Like var in C#.
Lambdas are just a way of defining methods in place. It has nothing to do with callbacks.
But you're spot on for memory safety. Managing it yourself is risky and if it can be managed at zero cost it seems stupid not to.
I'm aware, but one of the big arguments I've heard about dynamic typing is "I don't know which type it has when I read the code". Well, auto looks just like var in that regard.
Callback definition from wikipedia:
This is exactly what lambdas are often used for in C++.
Anti Commercial-AI license
It really isn't. Neither in C# nor in Java. They are just syntactic sugar to avoid redundant type specifications. I mean things like
Foo foo = new Foo();
. Who gets confused with that?Why do you think IDEs are able to tell which type a variable is?
Even C# takes a step further and allows developer to omit the constructor with their target-typed new expressions. No one is whining about dynamic types just because the language let's you instantiate an object with
Foo foo = new();
.