From a35d010dfe2b2769cf13ae508952c279aecb3aac Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Thu, 6 Sep 2018 12:46:39 -0700 Subject: Removed the mandatory "_" prefix for Nomsu variables, renamed "list" and "dict" to "List" and "Dict", or in Nomsu's environment, "_List" and "_Dict", removed uuid.lua and replaced it with core/id.nom for handling IDs. --- core/operators.nom | 22 ---------------------- 1 file changed, 22 deletions(-) (limited to 'core/operators.nom') diff --git a/core/operators.nom b/core/operators.nom index 7e30705..9395d9d 100644 --- a/core/operators.nom +++ b/core/operators.nom @@ -19,28 +19,6 @@ compile [%a is %b, %a == %b] to (..) compile [%a isn't %b, %a is not %b, %a not= %b, %a != %b] to (..) Lua value "(\(%a as lua expr) ~= \(%b as lua expr))" -# For strict identity checking, use (%x's id) is (%y's id) -test: - assume (([] == []) and (([] 's id) != ([] 's id))) -lua> ".." - do - local new_uuid = require('uuid') - local NaN_surrogate = {} - local nil_surrogate = {} - IDS = setmetatable({}, { - __mode = "k", - __index = function(self, key) - if key == nil then return self[nil_surrogate] - elseif key ~= key then return self[NaN_surrogate] end - local id = new_uuid() - self[key] = id - return id - end - }) - end - -compile [% 's id, id of %] to (Lua value "IDS[\(% as lua expr)]") - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ test: -- cgit v1.2.3