Revert "Failed attempt at allowing read-string and eval. The problem is that the compiler context sits on the worker, and so I cannot make a synchronous eval. Clojure is much much simpler - it simply uses Javas namespaces and adds functions to them, which means they can be used in macros."

This reverts commit 264fdd45772dfc20a473d80d706dfce6e958fa64.

--- src/js/app/compilers/teascript/compiler.coffee
+++ src/js/app/compilers/teascript/compiler.coffee
@@ -2637,20 +2637,6 @@
         compiled = termCompile ctx, term
         (irJsCompatible term.tea, compiled))
       (jsCall "js#{jsMethod[0].toUpperCase()}#{jsMethod[1...]}", compatibles)
-
-ms['parse-shem'] = ms_parse_shem = (ctx, call) ->
-  [string] = _arguments call
-  compiledString = termCompile ctx, string
-  call.tea = toConstrained markOrigin expressionType, call
-  assignCompile ctx, call, (jsMethod 'runtime', 'parseShem', [compiledString])
-
-ms['eval-shem'] = ms_eval_shem = (ctx, call) ->
-  [source] = _arguments call
-  compiledSource = termCompile ctx, source
-  call.tea = toConstrained markOrigin jsType, call
-  fucked = eval translateToJs translateIr ctx, compiledSource
-  compiled = termCompile ctx, fucked
-  assignCompile ctx, call, compiled

 ms['=='] = ms_eq = (ctx, call) ->
     [a, b] = _arguments call
@@ -5586,20 +5572,16 @@
       js: ''
     }
   else
+    module = lookupCompiledModule moduleName
+    {modules, ctx} = contextWithDependencies moduleDependencies moduleName
     [expression] = _terms ast
-    result = compileExpressionFromAst expression, moduleName
-    result.ast = ast
-    result
-
-compileExpressionFromAst = (expression, moduleName) ->
-  module = lookupCompiledModule moduleName
-  {modules, ctx} = contextWithDependencies moduleDependencies moduleName
-  compilationFn = (topLevelExpressionInModule importsFor moduleDependencies moduleName)
-  {js} = compileCtxAstToJs compilationFn, ctx, expression
-  (finalizeTypes ctx, expression)
-  js: library + immutable + (listOfLines map lookupJs, (setToArray runtimeDependencies moduleName)) + '\n;' + js
-  errors: checkTypes ctx
-  malformed: ctx.isMalformed
+    compilationFn = (topLevelExpressionInModule importsFor moduleDependencies moduleName)
+    {js} = compileCtxAstToJs compilationFn, ctx, expression
+    (finalizeTypes ctx, expression)
+    js: library + immutable + (listOfLines map lookupJs, (setToArray runtimeDependencies moduleName)) + '\n;' + js
+    ast: ast
+    errors: checkTypes ctx
+    malformed: ctx.isMalformed

 importsFor = (moduleSet) ->
   lookupDefinitions = (name) ->
@@ -6025,16 +6007,6 @@

 # end of Utils

-# Exported runtime
-runtime =
-  parseShem: (string) ->
-    astize tokenize string
-
-  evalShem: (ast) ->
-    {js} = compileExpressionFromAst ast, moduleName
-    {js} = compileCtxAstToJs topLevelExpression, (new Context), ast
-    eval js
-
 # Unit tests
 test = (testName, teaSource, result) ->
   try
@@ -7387,7 +7359,6 @@
 #   exports"""

 exports.library = library
-exports.runtime = runtime

 exports.originOf = originOf
 exports.sortedArgs = sortedArgs


Add error message in cons

Add error message in cons

--- src/js/app/compilers/teascript/compiler.coffee
+++ src/js/app/compilers/teascript/compiler.coffee
@@ -798,6 +798,9 @@
 };

 var and_ = function (x, xs) {
+  if (xs == null) {
+    throw new Error('Second argument to & must be a sequence');
+  }
   if (typeof xs == 'string' || xs instanceof String) {
     return x + xs;
   }