Closed felixvisee closed 11 years ago
ASTCompose
clones most of the macros created for and used by ASTPartial
, maybe they should be extracted?
ASTCompose clones most of the macros created for and used by ASTPartial, maybe they should be extracted?
I wonder if that wouldn't make things worse. C macro metaprogramming isn't the nicest thing on earth, I'd say we leave it for now
Going back and forth one this one. I'm not sure I'm convinced that
id (^block)(id) = ASTCompose(
ASTLift0(length),
ASTPartialRight(ASTLift(objectForKey:), @"foo")
);
beats
id (^block)(id) = ^(id arg) {
@([[arg objectForKey:@"foo"] length]);
}
I think lift and partial are most useful when using each, map or reduce. However, if you need to invoke multiple methods, writing them out may be the clearer alternative. This feels like you lose more type information and clarity than what you lose in terms of convenience.
Also, this currently only handles id -> id?
so we'd still need to add some more macros to support blocks of higher arity.
ASTCompose
adds function composition to Asterism. Short example: