From a0e921e9ee5a4e510d107fd64f89e5956664986a Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Wed, 21 Aug 2024 14:35:21 -0400 Subject: [PATCH] xo-expression: LambdaAccess [wip] --- include/xo/expression/Lambda.hpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/include/xo/expression/Lambda.hpp b/include/xo/expression/Lambda.hpp index be4d833d..7ba7cdd2 100644 --- a/include/xo/expression/Lambda.hpp +++ b/include/xo/expression/Lambda.hpp @@ -98,7 +98,6 @@ namespace xo { **/ static std::string assemble_type_str(TypeDescr lambda_td); - private: /** @param lambda_type. function type for this lambda. * We arbitrarily choose the form "Retval(*)(Args...)" **/ @@ -107,6 +106,7 @@ namespace xo { const rp & local_env, const rp & body); + protected: /** compute free-variable set for this lambda **/ std::set calc_free_variables() const; @@ -118,17 +118,17 @@ namespace xo { **/ std::map> regularize_layer_vars(); - private: /** lambda name. Initially supporting only form like * (define (foo x y z) * (+ (* x x) (* y y) (* z z))) * - * In any case need to supply names for distinct things-for-which-code-is-generated - * so that they can be linked etc. + * In any case need to supply names for distinct + * things-for-which-code-is-generated so that they can be linked etc. **/ std::string name_; /** e.g. - * "double(double,double)" for function of two doubles that returns a double + * "double(double,double)" for function of two doubles that + * returns a double **/ std::string type_str_; /** function body **/ @@ -177,6 +177,11 @@ namespace xo { const rp & body); static rp make_empty(); + /* TODO: make sure Lambda members that depend on non-emtpy body + * get calc'd + */ + void assign_body(const rp & body); + private: /** lambda_type, body can be null here, * in which case fill in with assign methods