glom icon indicating copy to clipboard operation
glom copied to clipboard

Fill used implicitly in T, Call, MExpr

Open kurtbrose opened this issue 5 years ago • 3 comments

there are places where values are interpreted as constants, except for a few special cases carved out

  • T will evaluate other T, Spec
  • Call will evaluate other T, Spec
  • MExpr will evaluate Msubspec

in all these cases, Fill() could be used instead:

so T and (1, T) would both work the same way -- Fill() basically says "walk down literals and mostly leave as-is, but if specs are present evaluate them"

The only "extra" thing that Fill does is call callables; not sure if this is okay as an intrinsic behavior, or if we should make something else that is like Fill but only recurses, doesn't do any calls.

kurtbrose avatar Jun 28 '20 00:06 kurtbrose

an example of how this might combine with MExpr

M((T.a, T.b)) == (1, 2)

kurtbrose avatar Jul 08 '20 01:07 kurtbrose

This may be applicable to default argument in a lot of places -- this would let us strike a middle-ground between "always spec" and "always a constant"

another place it could be useful is something like Let() or S() -- although currently those are "always spec"

kurtbrose avatar Aug 05 '20 20:08 kurtbrose

https://github.com/mahmoud/glom/pull/196 would cover this nicely

kurtbrose avatar Sep 27 '21 00:09 kurtbrose