Memory model as type. #865
Replies: 5 comments 6 replies
-
Yes, see #27 (comment). |
Beta Was this translation helpful? Give feedback.
-
You can already use the Cpp1 standard library in Cpp2. |
Beta Was this translation helpful? Give feedback.
-
What would be the benefit of writing i: int <shared_ptr> instead of writing i: shared_ptr. Also your angled brackets would clash with template definitions. What other symbol would you propose to eliminate the clash? |
Beta Was this translation helpful? Give feedback.
-
Thanks for the feedback! I've thought about this and I don't think it's a direction I want to pursue for now. I don't understand well what existing known pitfalls this aims to solve. And I think it's an important feature of C++ that I can allocate an object in any location and not have its location be part of its type (including that I can invoke |
Beta Was this translation helpful? Give feedback.
-
Are you suggesting a debug meta type that printed to console whenever a type is constructed/destroyed/copied/moved?
On 22 December 2023 04:25:47 YagaoDirac ***@***.***> wrote:
Hi.
I'm not pro in making programming lang.
My idea is mainly for, if it's a type, then we can do everything we do to type to it. We can print out the memory model, convert the memory model in a verbose way.
It's more about learnability, not read ability or writability.
Actually I found the hardest part is learning. I'm learnt 7 programming languages, glanced 2 or 3 more, 1.5 natural lang other than my first lang, and a lot. The era really forces us to learn as much.
I'm recently having some fun on a personal and "only for fun" language. I tried to shrink the amount of learning to extreme, while maintain other good things as possible. It looks a bit weird, but I really think it's the way. It's very easy to learn especially for people who already have at least some exp in programming. It's not uploaded now. If you are interested in it, I'll prioritize it a bit so to upload it as soon.
—
Reply to this email directly, view it on GitHub<#865 (reply in thread)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AALUZQMYE2MQ2MGFUWTNMLTYKUDURAVCNFSM6AAAAABAETOYJ2VHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM3TSMRUGI4TM>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Hi.
I briefly read the titles of all the discussions, I don't know if this suggestion overlaps any of them. Sorry for that if it happens.
The idea:
Memory model can help compiler to do some checking, just like the type system does. So can we also add the memory model to some where in the type system.
I mean, all the unique_ptr, share_ptr, in, inout, instant value, left value, right value, in my mind are all memory models. In cpp1, smart pointers are implemented in std lib, but a lot others are made in syntax. I'm confused sometimes when they are implicitely converted into some others. If they are part of the type system, at least I can cout them.
So, my idea is like, the type system should become 2 layers. 1 is the the same as it is in cpp1 now(int, bool, float, object), the 2nd is the memory model. So, we would have:
Optional.
Nullable can also be part of the type system. Maybe this is already decided.
Generic and constraint(for better error info) in memory model. Since the "last use"check is already there, so it's possible to seperate the && way from others, with a much better error info.
The restrict keyword from c. Maybe it's possible to pick this up this time. Or do we need it anymore?
Maybe this is also a better way to introduce pmr in cpp17 into cpp2.
Beta Was this translation helpful? Give feedback.
All reactions