Jouke Witteveen writes: > Hi, > > I would like make to have scoped variables. Here, I will propose an > implementation of them. This implementation is currently without tests and > documentation. Hopefully, the proposal is acceptable and I can add the > tests and documentation. > > Consider a situation in which we have macros F and G, and some variable X, > and our makefile includes: > > $(call F,$(call G,$(X)),$(call G,$(X)))
Your proposal has the potential to create variables that would have scope local to a single invocation of a user-defined function, but it wouldn't provide scoping to Make-proper. For that reason alone, I would suggest narrowing down the naming of the feature. Perhaps something like: Function local variables Have you considered how this might affect target- and pattern-specific variables? What would the affect be of a local variable overriding the name of a global variable? Finally, have you taken a look at the so-called Gnu Make Standard Library (GMSL)? The implementation of dictionaries in that piece of software reduces the need to introduce changes to Gnu Make to support variable scoping -- but I accept that might be a controversial view.