Feel free to advice how I can point out all the issues I’ve seen without disappointing you. FWIW, if I’m not open minded to what you are proposing, I would have just straight out calling it non-sense, useless and ignoring it. I do agree it has some properties that you’ve claimed and I don’t believe that need any further discussion. (Discussiong things that are clear enough is what I meant by admiring above, especially when it’s about the positive aspect.) The only thing that need discussion is what you didn’t mention, including the support for all current usage and the real impact on the compiler. Those are exactly what I was tallking about. The fact that I didn’t make any positive comment on that is simply because from the basic outline you’ve given I can only see what problems they can cause without an obvious way around it. I would certainly have mentioned possible way out if I come up with one. If there is indeed one, then I still believe explicitly showing the problem is the best way to promote you, the only one who really know what you are actually proposing, to come up with potential methods to solve them.
OK, so, still the same issues. It works only because the caller is actually a module that is aware of Foos
, which have two immediate problem that I’ve pointed out above,
-
There’s a version of
forloop
that’s aware ofFoos
and a version offorloop
that’s unaware ofFoos
so that the code will run correctly when calling from different context. That’s the compiler problem that I’ve mentioned repeatly above. -
It’s still impossible (AFAICT) to move part of the implementation of
forloop
to a different function or different module. As a concrete example, ifforloop
is defined as,forloop2(...) = <your current implemenntation> forloop(...) = forloop2(...)
and only
forloop
is exported. Then according to your rule,forloop2
will only resolve function inForLoop
and notFoos
(since onlyforloop
will be called externally andforloop2
is only called fromforloop
, which is inForLoop
). Note that this is exactly thef
andf2
I’ve used twice above.This is made even worse if you want to extend the function of
forloop
by wrapping it in another functionforloop3
in another moduleForLoop3
. You can improve these better by chaining all the way up but 1) that’ll be a pretty confusing rule IMHO (since it’s extremely context dependent, think dynamic scope) and kind of back to where we are in most cases if you start fromMain
. Depending on the exact rule, it’ll also make compiler problem even harder since you’ve got a whole chain of context to consider before compilation…Do note that all of the usecases I’ve mentioned above (
forloop2
: implementation detail helper functions; andforloop3
: wrapper functions) are existing and real usecases that must be supported.
I’ve often found that @yuyichao is not open to new ideas that are different from what’s currently the status quo
I do agree with this to some degree and while I have proposed and implemented big changes before, I hold all my proposals to the same standard that it need to withstand every current usecases that I can come up with. For all usecases that should be supported, it should be either unaffected or can be achieved relatively easily in a slightly different way.
Note that this is different from @force
. It’s not a feature with huge impact. It’s just the base policy to not put every small things in as long as it doesn’t have to be. AFAICT, putting it into base/add as language feature is the only thing I’m against about it.