Closed porky11 closed 6 years ago
There are a few problems with this change:
for-each
concept macro, the principal difference being that the function to which for-each
expands takes a function pointer representing the body of the loop, whereas this takes that body directly, which in turn allows the body to reference other bindings present in the local scope. stdlib
now includes references to container concepts, but container concepts are defined by modules that depend on stdlib
. Since this is a macro, and the dependency is implicit anyway, this doesn't prevent the relevant code from compiling. However, it's not very appealing from a dependency graph perspective.The first problem is the main one. Although being able to refer to local bindings in the body of the loop is very useful, I'm not sure whether this is the correct approach for dealing with that (cf. e.g. implementing closures and using the existing forms, or adding some sort of macro wrapper around the existing forms). I'm not inclined to merge this until possible alternatives have been investigated more fully.
Seems good. If there are better alternatives, they should be used. Maybe with additional features. (maybe even similar to lisp loop)
I'd prefer adding typechecking at macroexpansion time instead of using concept macros
see commit descriptions