FUNCT was an R3-Alpha-ism that made it easier to keep track of one's declaration of local variables in functions. It walked the body of the function looking for any SET-WORD! usages. If those set-words didn't name arguments or explicit locals...and weren't explicitly specified as being non-local via the /EXTERN refinement...they would be automatically made local.
It gained popularity since declaring locals manually is more of a hassle--and stale locals are hard to notice and can linger after their references are all removed. Since it was popular, several people (myself included) lobbied for it to get the name FUNCTION.
However:
-
locals-gathering via SET-WORD! turned out to be problematic for several reasons that I have repeatedly explained
-
I've come to think that having FUNC be anything other than a shorthand for FUNCTION is confusing...an abbreviation that has drastic changes in behavior seems bad.
I feel pretty good about the current plan to switch over to a mix of virtual-binding-based LET...with explicit <local>
when it makes sense. This means FUNCTION as we have known it (which is to say FUNCT) is going to die.
Plan is to Temporarily Deprecate FUNCTION in favor of FUNC
I'm going to deprecate FUNCTION for a while... and just use FUNC with LET (or <local>
). Once this has gotten wide acceptance, we can reintroduce FUNCTION as a synonym for FUNC.
This is a slow process, because doing the change across large bodies of code is exposing issues in the virtual binding mechanics. So I don't know the exact time when FUNCTION will be going away.
But I have committed one step of moving away from the "gathering of SET-WORD!s" model. I changed METHOD to no longer be the "gathering form of METH". This gave me an idea of how hard it would be to get a bootstrap executable to fake up LET mechanics...even though it doesn't have virtual binding.
I left behind METH/GATHER as a compatibility form... just because that's how it was implemented prior (method: :meth/gather).
Ideally you would not use METH/GATHER, instead you would convert your code to use LET... unless you think your code is too performance sensitive, in which case you would declare your <local>
variables in the function spec.
What's the Role of the /GATHER Mechanic, And What to Call It?
I think locals gathering through SET-WORD! is a good code golf tool. But does it have a place in the system besides that?
I'm not thrilled about leaving it on FUNC itself as part of the core "important" code... as a refinement or as part of the spec language.
Does anyone have a super strong vote for it, or it needing a name, or does LET + <local>
feel like it covers enough for what's needed in the box?