Thanks for feedback!
(1) Changes are next
(A) Change in types:
- Each specific type (not
<T>), which is supported by partial type extension (Stucts and Tuples) has partiality (partial-access): has "SomeSt.%something" at the end or "SomeSt<T>.%something" - If partiality is omitted, it means
.%full. SoSomeStis same asSomeSt.%full - partiality could be specific or general(
St.%a) like lifetime, but we mostly use in specific form - Full form of specific partiality is next: "
St.%{%access1 fld1, %access2 fld2, ...}" where "%access = %permit | %deny | %miss | %ignore" andfld- are field names (or number for tuples). -
%permitfield-access mean that field has access to read, to write (if mut), to borrow. -
%denyfield-access forbid to have any access to read, to write, to borrow (like private fields) -
%missfield-access is same as%deny, but it is possible to convert into%permit -
%ignorefield-access is quasi-access, it make unclear real field-access (%permit,%denyor%miss) - We add some sugar: if field-access is omitted, it means
%permit, if field-name is omitted, it field-access is%deny - we add some sugar:
-
*- "all fields" quasi-field, -
_- "rest of fields" quasi-fields, -
self- quasi-fields for unsupported types -
%full = %{*} = %{%permit *}- full access, -
%empty = %{} = %{%deny *}- no access -
%any = %ignore _- ignore rest of fields -
%unfill = %miss _- missed rest of fields
- All unsupported types has singe filed -
selfand it is always%permit, so these types are always%full
(2) Change in Variable use:
- Each used variable, which is supported by partial type extension (Stucts and Tuples)
has partiality (partial-access filter): has "
var.%something" at the end or "self.var.%something" - Full form of specific filter-partiality is the same as partiality for type
- we add specific partial-filters, which depends from variable detailed partiality:
| var part | %max |
%exact |
|---|---|---|
%permit |
%permit |
%permit |
%deny |
%deny |
%deny |
%miss |
%miss |
%miss |
%ignore |
%deny |
%ignore |
- we add specific partial-filters for arguments, which depends from detailed partiality of parameter of a caller function:
| var part | %arg |
|---|---|
%permit |
%permit |
%deny |
%deny |
%miss |
%miss |
%ignore |
%deny |
- We add some sugar: if field-access is omitted, it means:
= .. &? mut? var ~ = .. &? mut? var.%max-
return &? mut? var ~ return &? mut? var.%exact(explicit (?or implicit)return) self.call( &? mut? var ) ~ self.call( &? mut? var.%arg )
- If we have a variable with
%missfields and make an reference (mutable or not), referenced partiality convert own%missfield-accesses into%deny(origin variable partiality remains the same).
(C) changes in parameters
- Parameter Type partiality could consist
%ignorefields. All argument field-accesses must match with parameter's type and type field-access. Except%ignorefields. - Inside function body ignored parameters fields are
%ignoreaccess -
%ignorefiled is like%denyfield (except forreturn)
(D) changes in initialization (and deconstruct match binding)
- Each used Constructor, which is supported by partial type extension (Stucts and Tuples)
has variable partiality (partial-access filter): has "
St{...}.%something" at the end or "(...).%something" - Variable filter-partiality follows (B)
- Full form of specific partiality of Struct Constructor is next: "
St {%access1 fld1: val1, %access2 fld2 : val2, ...}". where%access = %permit | %miss | %deny. - Full form of specific partiality of Tuple Constructor is next: "
(%access1 fld1: val1, %access2 fld2 : val2, ...)". where%access = %permit | %miss | %deny. - We ad some sugar: If field-access is omitted it means
%permit. If field name is omitted (not for Tuples), it field-access mean%miss - We could change
%missfield-access into%permitby(let=)operator.var.missed_fld let= val;. So it is both assignment and changing type. Sure, We could simplify and just use(=)instead
(2) Changes in mutability by partiality
- Each mutability for variables is supported by partial type extension (Stucts and Tuples)
has partiality (partial-mutability): has "
mut.%something" at the end - Full form of specific partial mutability is next: "
mut.%{%access1 fld1, %access2 fld2, ...}" where "%access = %permit | %deny" andfld- are field names (or number for tuples) with same sugar : if field-access is omitted, it means%permit, if field-name is omitted, it field-access is%deny. -
%permitfield-mutability mean "mutable" - allow to read, to write, to mutable and immutable.borrowing. -
%denyfield-mutability mean "immutable"/"const" - allow to read, to immutable.borrowing. -
mut.%lift- is a specific mutability - same as mutability in sharing part of type declaration. - we could mixed partiality from type and from mutability together, but we must use
&? mut.%typeor&? mix = &?mut.%type` in "sharing" part of "type". - Full form of specific --mixed** partiality is next: "
St.%{mut? %access1 fld1, mut? %access2 fld2, ...}", if filed is marked as "mut" , this field ismut.%{..., %permit fldN, ...}, if not, thenmut.%{..., %deny fldN, ...}. - We add some sugar: if field-mutability is omitted, it means:
self.call(& var) ~ self.call(& var)self.call(&mut var) ~ self.call(&mut.%arg var)= .. & var ~ = .. & var= .. &mut var ~ = .. &mut.%max varlet var = .. ~ let var = ..let mut var = .. ~ let mut.%full var = ..let mut var : .. = .. ~ let mut.%lift var : .. = ..let .. : &mut Type = .. ~ let .. : &mut.%full Type = ..let .. : &mix Type = .. ~ let .. : &mut.%type Type = ..let .. : mix Type = .. ~ let .. : mut.%type Type = ..
(1 + 2)
- combing Partial Types and Partial mutability is simple and do not contradict each other
self.call(&mut var) ~ self.call(&mut.%arg var.%arg)= &mut var ~ = &mut.%max var.%maxreturn &mut var ~ = return &mut.%max var.%exactlet mut var: mix Type.%{..} = .. ~ let mut.%lift var: mut.%type Type.%{..} = ..
And .... that is all grammar!