About the RFC question:
Is the word “delegate” really appropriate in this context?
If I am right, it is wanted to select one portion of source code from one origin and insert it in a destination, after modifying/filtering the namings accordingly under the needs, maintaining the origin-destine code relationship.
This way, when the code in the origin is modified (added or retouched methods, fields, etc), those items/code become propagated to all the destinations whom linked such model for replicate, as if it were done by hand, what means is the lexer engine who would play here, before sending to compiler stage.
If this is correct, I think that propagate
or replicate
could be alternative words for this matter. Depending of were is going to be placed Origin and Destine in the syntax:
// Example.1 , modification of stile proposed in RFC
impl Foo for Bar {
replicate Foo { * | field_des }
}
// The redundancy of signalizing Foo as Origin is helpful for newcomers
// , just it is needed to say it can be omitted.
But, reading the comments of the threads talking about this matter, the content of {...}
, with the cross of time (may be years), it could become a:
// Example 2, refactoring matrix
// What From To
// ------------ ----------- -----------
{
fn * { fieldA_ori | fieldA_des }
fn func_name { fieldB_ori | fieldB_des }
field { fieldC_ori | fieldC_des }
name fn { func_name_ori | func_name_des }
type { typeA_name | typeB_name }
use for { self.0 typeA_name | self.0 typeB_name }
fn func_name2, fn func_name3
{
fieldB_ori | fieldB_des,
fieldC_ori | fieldC_des,
fieldD_ori | fieldD_des,
}
etc
}
What I think would be very hard to follow, newbies and no so newbies, from my humble point of view. Or probably I did not understood this part of the RFC.
But, thinking on it, one thing the code text editors could do after detect the delegation
is to show the replicated code/functions in place ( with an unfold button ), for quick understanding of whats being replicated in example 2
. In fact, If that happens, probably I would not find hard difficulties in the example 3
, what I would consider in such case almost an advantage, because I would see in real time the pattern changes. Or perhaps is to much dependence or guessing in thirds ?
I am just starting to explore the language, so I apologize in advance for the lack of quality in my comments.
Thank you all for being there fighting