summaryrefslogtreecommitdiff
path: root/starts/meaning-vm/level-2
diff options
context:
space:
mode:
Diffstat (limited to 'starts/meaning-vm/level-2')
-rw-r--r--starts/meaning-vm/level-2/common.hpp9
-rw-r--r--starts/meaning-vm/level-2/funcs.cpp9
-rw-r--r--starts/meaning-vm/level-2/sugar.hpp8
3 files changed, 19 insertions, 7 deletions
diff --git a/starts/meaning-vm/level-2/common.hpp b/starts/meaning-vm/level-2/common.hpp
index 6f70f09..aac072e 100644
--- a/starts/meaning-vm/level-2/common.hpp
+++ b/starts/meaning-vm/level-2/common.hpp
@@ -1 +1,10 @@
#pragma once
+
+namespace intellect {
+namespace level2 {
+
+template <typename T> struct baseref;
+struct ref;
+
+}
+}
diff --git a/starts/meaning-vm/level-2/funcs.cpp b/starts/meaning-vm/level-2/funcs.cpp
index 4ee02a4..c25ead2 100644
--- a/starts/meaning-vm/level-2/funcs.cpp
+++ b/starts/meaning-vm/level-2/funcs.cpp
@@ -1,13 +1,16 @@
-#include "funcs.hp"
+#include "funcs.hpp"
#include "../level-1/sugar.hpp"
+#include "ref.hpp"
+
namespace intellect {
+using namespace level1;
namespace level2 {
-level2::ref context()
+ref context()
{
- static thread_local level1::ref ctx = level1::a("context");
+ static thread_local auto ctx = a("context");
return ctx;
}
diff --git a/starts/meaning-vm/level-2/sugar.hpp b/starts/meaning-vm/level-2/sugar.hpp
index 3e94c97..6734eae 100644
--- a/starts/meaning-vm/level-2/sugar.hpp
+++ b/starts/meaning-vm/level-2/sugar.hpp
@@ -11,12 +11,12 @@
#undef self
#define ahabit(name, ...) \
a(habit, name); \
- (name).fun((std::function<ref(ref)>) \
- [=](ref ctx) -> ref\
+ (name).fun((std::function<void()>) \
+ [=]() -> ref\
{ \
habitdelay; \
- ref self = name; \
- (void)self; \
+ ref self = name; (void)self; \
+ ref ctx = intellect::level2::ref::context(); (void) ctx;\
__VA_ARGS__ \
return intellect::level1::concepts::nothing; \
});