~icefox/garnet#54: 
Do something about the "type unwrap" operator

We need some way to explicitly unwrap nominal types, in the places it's allowed, but we also need to infer the common case. Hmmm.

Status
REPORTED
Submitter
~icefox
Assigned to
No-one
Submitted
1 year, 7 months ago
Updated
5 months ago
Labels
T-TODO

~icefox 1 year, 7 months ago

Basically the problem as it stands is we have nominal types and structural types, and doing foo.bar takes a structural type. So you need to do foo$.bar to say "find the type of foo, and if it's a Named type look it up and make sure it resolves to a structural type." So we just need to make it do the lookup automatically when possible. Which then kinda folds into "do we have visibility permissions on type fields in general", which is really a good idea we should do, but is more work I don't want to do yet.

~icefox 5 months ago*

Ironically it appears that ML modules' "sealing" operator is exactly this same problem, it takes a structural type and turns it into a nominal type with a particular signature. IMO ML's style of doing that is also something I have never ever wanted. Rust-style public/private visibility is way easier to think about. Chapter 1 of Dreyer's thesis, "The design space of ML modules", is a good intro to this. ML's transparent/sealed/translucent approach is just a generally weird and janky way of achieving this afaict.

Register here or Log in to comment, or comment via email.