Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong description of types #31

Open
FrankHB opened this issue Sep 17, 2018 · 0 comments
Open

Wrong description of types #31

FrankHB opened this issue Sep 17, 2018 · 0 comments

Comments

@FrankHB
Copy link

FrankHB commented Sep 17, 2018

A unique_ptr<node> is no longer a node—it’s a unique_ptr masquerading as a node. It’s preferable to retain the type of node*, and retain the properties of node*-ness that go along with it, because we don’t really actually care about unique_ptr for its own sake.

This is technically wrong. The type named node* is never equivalent to the type node in C or C++, neither. The * declarator in C or C++ is essentially another masquerading unary type constructor. It is actually aliased as something like std::add_pointer_t in modern C++. There is nothing new about "masquerading" once you can have parametric types in general, either with std::add_pointer_t<node> or node*.

You seem to have intention of preferring to the default typing discipline with less type safety guarantees (e.g. about unexpected subtyping between some_raw_ptr<node> vs some_owned_ptr<node>), but it is not reasonable from the description here.

Besides type safety and verbosity, there remains probably only one significant difference: * is built in the core language. This is just because it comes from the language without uniformed syntax of type constructor like C++ template, which is irrelevant here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant