diff options
author | olpc user <olpc@xo-5d-f7-86.localdomain> | 2019-12-09 03:13:14 -0800 |
---|---|---|
committer | olpc user <olpc@xo-5d-f7-86.localdomain> | 2019-12-09 03:13:14 -0800 |
commit | 584ca7f9b6fca6da54608d3b28274273b2c9a4b8 (patch) | |
tree | d553b549cf246ddb24c93f9a95467bf9e019c052 /starts/meaning-vm/level-2/sugar.hpp | |
parent | 8d238e65a88502b897f1944b7844afffdbc0d761 (diff) | |
download | standingwithresilience-584ca7f9b6fca6da54608d3b28274273b2c9a4b8.tar.gz standingwithresilience-584ca7f9b6fca6da54608d3b28274273b2c9a4b8.zip |
make level-2 have refs
Diffstat (limited to 'starts/meaning-vm/level-2/sugar.hpp')
-rw-r--r-- | starts/meaning-vm/level-2/sugar.hpp | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/starts/meaning-vm/level-2/sugar.hpp b/starts/meaning-vm/level-2/sugar.hpp index 2fa9414..3e94c97 100644 --- a/starts/meaning-vm/level-2/sugar.hpp +++ b/starts/meaning-vm/level-2/sugar.hpp @@ -12,7 +12,7 @@ #define ahabit(name, ...) \ a(habit, name); \ (name).fun((std::function<ref(ref)>) \ - [=](ref ctx) \ + [=](ref ctx) -> ref\ { \ habitdelay; \ ref self = name; \ @@ -21,6 +21,25 @@ return intellect::level1::concepts::nothing; \ }); +// thinking on handling arguments with less boilerplate, more positional sugar +// transfer argslist to a context for calling? +// possibly transfer argslist to a function signature for the call +// transfer context to the argslist for handling call +// for each item of argslist, make a local variable, and set it to its value +/* +#define _positionalhabitarg(local, arg) \ + ref local = ctx.get(arg); +#define _ph + +#define apositionalhabit(name, argslist, ...) \ + a(habit, name); \ + (name).fun((std::function<ref(ref)>) \ + [=](ref ctx) \ + { \ + \ + }); +*/ + // seed random number generator statically, for habitdelay namespace __internal { static struct timespec __tp; |