about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-01-28 21:39:13 -0800
committerKartik K. Agaram <vc@akkartik.com>2015-01-28 21:39:13 -0800
commitd687a93f2b69bb9646cd17785806d27f0d84ec82 (patch)
tree004cca71c9b797547375457311512c3285e11674
parentb6ea96bb07c6497b0913e7b5d87a09033d86e09a (diff)
downloadmu-d687a93f2b69bb9646cd17785806d27f0d84ec82.tar.gz
664 - new, wart-like prompt
This is the right time for this change I've been meaning to make,
because it lets me drop my hack in 'abort-to'.

'abort-to' is likely still a bad idea because:
  a) Just because this example doesn't need to clear a few things on
  abort doesn't mean such use cases don't exist. In other words, there's
  no way to tell if your stack frame recently returned from an abort.
  That question isn't even well-posed at the moment; what does
  'recently' even mean?

  b) I may need to run deferred statements on each stack frame, and it's
  not clear how to rewrite 'defer' to be robust to aborts. Exceptions
  entering through the back door?

  Looks like all this is expected when implementing exception-like
  behavior using continuations:
    http://matt.might.net/articles/implementing-exceptions

  c) Of course we don't have composable exceptions. I still don't grok
  the value of that. We don't need yield since we have channels. What
  else might we need continuations for? Let's try to come up with a
  clean way to implement the amb operator or something.
    http://www.randomhacks.net/2005/10/11/amb-operator
-rw-r--r--color-repl.mu5
-rw-r--r--mu.arc1
2 files changed, 4 insertions, 2 deletions
diff --git a/color-repl.mu b/color-repl.mu
index 3042c1cf..efa80344 100644
--- a/color-repl.mu
+++ b/color-repl.mu
@@ -305,15 +305,18 @@
 (function main [
   (default-space:space-address <- new space:literal 30:literal)
   (cursor-mode)
+  (print-primitive-to-host (("connected to anarki! type in an expression, then hit enter. ctrl-d exits. ctrl-g clears the current expression." literal)))
+  (print-character nil:literal/terminal ((#\newline literal)))
   { begin
-    (print-primitive-to-host (("anarki> " literal)))
     (s:string-address <- read-sexp)
     (break-unless s:string-address)
     (retro-mode)  ; print errors cleanly
       (t:string-address <- $eval s:string-address)
     (cursor-mode)
+    (print-primitive-to-host (("=> " literal)))
     (print-string nil:literal/terminal t:string-address)
     (print-character nil:literal/terminal ((#\newline literal)))
+    (print-character nil:literal/terminal ((#\newline literal)))  ; empty line separates each expression and result
     (loop)
   }
 ])
diff --git a/mu.arc b/mu.arc
index 7e1c5f3e..5089a8db 100644
--- a/mu.arc
+++ b/mu.arc
@@ -830,7 +830,6 @@
                     (until (is caller top.routine*!fn-name)
                       (pop-stack routine*)
                       ; no incrementing pc; we want to retry the call
-                      (-- pc.routine*)  ; temporary hack, hardcoded for color-repl.mu
                       )
                     ((abort-routine*)))