[SUGGESTION] About what classes can possibly look like #585
burbokop
started this conversation in
Show and tell
Replies: 2 comments
-
Now there's a creative use of multiple named return values! Thanks for sharing this. I just enabled Discussions, so I'll convert this to a discussion which hopefully will make it easier to discuss and find again in the future (and then I need to go back and do the same to a bunch of other Issues). |
Beta Was this translation helpful? Give feedback.
0 replies
-
It's also pretty much how Javascript does classes (or used to, I think now there's a more declarative way). |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Some kind of classes already implemented in cppfront.
This code is perfectly compiled with latest version of cppfront (commit 9ca2f45).
cat
function is both a constructor and class itself. Something similar implemented in scala language where class declaration syntax is just like function declaration syntax but with additional class keyword.If there were ability to pass
self
parameter tosay_nya: std::function<void()>
which refers tocat__ret
structure than it would be more look like a member function.Conclusion: May be cpp2 does not need special syntax for classes, almost everithing that needed is already here.
Thank you for your work.
Beta Was this translation helpful? Give feedback.
All reactions