nikomatsakis / babysteps

Babysteps blog
https://smallcultfollowing.com/babysteps/
31 stars 22 forks source link

Comment about "View types" #4

Open michalfita opened 2 years ago

michalfita commented 2 years ago

I haven't found other way to comment https://smallcultfollowing.com/babysteps//blog/2021/11/05/view-types/, having discussion section here could help.

While the idea is noble in principle, the syntax is horrible! Please don't let it be considered in this form.

Please consider something more verbose, even the keyword to define them, something like:

struct TheType {
    element: Vec<u32>,
    option: Option<i32>,
}

view TheElementView: TheType {
   element,
}

That way then can be kept named and are much easier to read, digest, refactor, less inhibitive on the learning journey.

Maybe next step would be implementations for view types?