I think I probably should stop getting into this discussion, as it seems I am unable to convey my points clearly (or I am overconcerned about something that is not a big deal and everyone understands it). Also others should have a say without being swamped by my activity. So just one last try :-) :
Do I understand correctly, that, with the same fragment/submodel definition you would allow both of these two usages?
A:
data int shared_N;
model splines = spline_regression(shared_N);
model linear = linear_regression(shared_N);
B:
model splines = spline_regression();
model linear = linear_regression();
Where in case A, the main model has shared_N
as data, but does not have splines.N
and linear.N
as data. In case B, though, the main model has both splines.N
and linear.N
as data? This feels too much hacky/magical/unpredictable, for my personal taste but I guess you might be OK with it. It certainly saves writing time, but I am afraid it could noticeably increase debugging time and make it harder to understand what data should be supplied to a model.
The other interpretation I can make of your proposal is that only one of the variants A and B is allowed, depending on the number of parameters declared for the submodel/fragment constructor. In other words, the submodel/fragment developer decides whether they will force you to pass some data explicitly or whether the data will be implicitly read from the main model data reader. This feels not very useful as it would unnecessarily limit reusability.
On philosophical grounds, you could argue that globals are bad, including global reader streams. All languages I know move away from recommending globals. But I understand that this is a very particular use case other languages don’t really have.