From b3dea01d1ad6803b96865a846b56494506ccc74e Mon Sep 17 00:00:00 2001 From: olpc user Date: Sun, 24 Nov 2019 00:51:53 -0800 Subject: changes didn't pan out; next change is big (merging statementevaluable with ref). saving work. --- starts/meaning-vm/concept.hpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'starts/meaning-vm/concept.hpp') diff --git a/starts/meaning-vm/concept.hpp b/starts/meaning-vm/concept.hpp index c69ff10..eca2fa5 100644 --- a/starts/meaning-vm/concept.hpp +++ b/starts/meaning-vm/concept.hpp @@ -8,6 +8,7 @@ template struct vref; struct concept; template struct value; +class statementevaluable; struct ref { @@ -24,11 +25,11 @@ struct ref ref(char const * str) : ref(std::string(str)) { } ref(bool b) : ref(b ? "true" : "false") { } ref() : ref("nothing") { } - value & name() const; // this is a reference so that its char pointer lasts + vref name() const; operator const char *() const; // helper linking syntax sugar - ref operator=(ref that); + statementevaluable operator=(ref that); ref operator<<(ref target); ref operator[](ref links); @@ -75,12 +76,17 @@ struct concept }; template -struct value : public concept, public T +struct value : public concept { - value(T const & val) : T(val) { } + value(T const & val) : data(val) { } value(value const & val) = default; static value& of(ref c) { return *static_cast*>(c.ptr); } + + operator T&() { return data; } + operator T const &() const { return data; } + + T data; }; -- cgit v1.2.3