I don't see how OO isn't. especially for Rust's typesystem needs: making oo work with lifetime subtyping is hard we ran across a mini version of this problem for specialization and I don't think we ever properly could figure it out
-
-
Replying to @ManishEarth
Maybe with your language designer hat on Not with the language user hat on
2 replies 0 retweets 0 likes -
Replying to @erincandescent @ManishEarth
Honestly there are an awful lot of domains where I discount Rust immediately because the fact that I can't bring some private data along with my reusable code leaves me ripping hair out
2 replies 0 retweets 0 likes -
Replying to @erincandescent
Which C++ feature(s) did you have in mind here more concretely? (Like, private struct fields + public impl functions seems like it would fit the definition in Rust, so I'm assuming it's not that.)
1 reply 0 retweets 0 likes -
Replying to @glaebhoerl
The fairly obvious one is anything where I might want virtual methods and _upcalls_ (And I can't quite work out why this causes issues with lifetimes if you always treat &self as a whole object lifetime even if pointing to a superclass)
1 reply 0 retweets 0 likes -
Replying to @erincandescent @glaebhoerl
The problem is that subtyping in H-M style typechecking is really obnoxious. Rust leans on the fact that the only subtyping in Rust is lifetimes, which can be done at a later stage after H-M typechecking.
1 reply 0 retweets 2 likes -
Replying to @pcwalton @erincandescent
What's upcall?
But seriously, I googled for 15 minutes and it's all about privilege and FFI boundaries. Is this it? https://books.google.hu/books?id=TMmpCAAAQBAJ&lpg=PT339&ots=0GvwYmzXlp&dq=upcall%20downcall%20%22inheritance%22&pg=PT339#v=onepage&q=up-call&f=false …
With my language designer hat on I'd like to understand what this is about but atm I feel like a dense idiot.1 reply 0 retweets 0 likes -
I assume it's also not these https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=f74e72177fe68a07ac6e43ddadf646db …, which work.
1 reply 0 retweets 0 likes -
Replying to @glaebhoerl @pcwalton
calls to an overriden method from a superclass struct a { void foo() { bar(); } virtual void bar() = 0; } struct b: a { virtual void bar() { puts("hello"); }
1 reply 0 retweets 1 like -
Replying to @erincandescent @pcwalton
Hmmm I see. That does seem more 'interesting' to model. The closest I could get: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=c7b137964594da395b5e0d7d2247b8f3 … and tbh I'm not totally sure if that does the "same thing", but I think so. Is the issue with less-trivial hierarchies, or that you can't have private trait methods...?
1 reply 0 retweets 0 likes
For what it’s worth I think we could basically have classes/inheritance if trait objects could have data fields.
-
-
Replying to @pcwalton
I’d love to see that, if only because it’d provide a fairly direct path to rounding out the table of existential types that it‘s possible to express (boxed/unboxed × bounded/unbounded)
0 replies 0 retweets 0 likesThanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.