[ prog / sol / mona ]

prog


[Book] Sussman - Software Design for Flexibility

18 2021-03-23 22:20

I can't get the management software to work with Geiser. It works with plain Scheme mode but with Geiser if I evaluate a definition in a buffer it does not reach the REPL. For example, I have this this in a file outside the `sdf' directory:

(load "sdf/manager/load")
(manage 'new-environment 'combinators)

(define (foo x) x)

When I evaluate the second line with C-x C-e, I don't get any result in the echo area. If I evaluate the last line with C-x C-e after, it does echo back

=> foo

But when I try to use it in the REPL, it fails:

1 (user) => (foo 1)

;Unbound variable: foo
;To continue, call RESTART with an option number:
; (RESTART 3) => Specify a value to use instead of foo.
; (RESTART 2) => Define foo to a given value.
; (RESTART 1) => Return to read-eval-print level 1.

2 error> 

The same thing works with plain Scheme-mode (without Geiser).

19 2021-03-23 23:15

>>18
I'm also having weird issues with Geiser but I don't see any problems with your example. Evaluating the second line with C-x C-e echoes:

=>new-environment

Using Emacs 27.1 with this minimal configuration for Scheme and Geiser:

;;;Scheme
(setq auto-mode-alist
      (cons '("\\.scm$" . scheme-mode)
	    auto-mode-alist))

(load-file "~/.emacs.d/elpa/geiser-0.12/geiser.el")
(add-hook 'scheme-mode-hook 'geiser-mode)
(setq geiser-default-implementation 'mit)
(setq geiser-active-implementations '(mit))
22 2021-03-24 17:23

This is the output I get when I set geiser-log-verbose-p and geiser-log-verbose-debug-p in emacs:

INFO: REQUEST: <20>: (geiser:eval '#f '(manage 'new-environment 'combinators))

INFO: RETORT: ((error (key . retort-syntax)) (output . "
;Loading \"sdf/common/overrides.scm\"... done
;Loading \"sdf/common/utils.scm\"... done
;Loading \"sdf/common/indexes.scm\"... done
;Loading \"sdf/common/collections.scm\"... done
;Loading \"sdf/common/memoizers.scm\"... done
;Loading \"sdf/common/predicates.scm\"... done
;Loading \"sdf/common/predicate-metadata.scm\"... done
;Loading \"sdf/common/applicability.scm\"... done
;Loading \"sdf/common/generic-procedures.scm\"... done
;Loading \"sdf/common/pretty-printer.scm\"... done
;Loading \"sdf/common/operators.scm\"... done
;Loading \"sdf/common/operations.scm\"... done
;Loading \"sdf/common/package.scm\"... done
;Loading \"sdf/common/predicate-counter.scm\"... done
;Loading \"sdf/common/simple-tests.scm\"... done
;Loading \"sdf/common/trie.scm\"... done
;Loading \"sdf/combinators/function-combinators.scm\"... done
;Value: (combinators)

1 (user) => "))

INFO: <20>: processed

It looks like it confuses the loading messages for errors? I wonder how it works for >>19, I have the latest Geiser from MELPA so it shouldn't be an issue? (Although I don't have the geiser-mit package installed, do I need that?)

23 2021-03-24 17:38 *

Looks like manage somehow breaks from from the eval:

1 (user) => (let ((environment (package/environment (find-package '(user) #t))))
  (eval '(begin (display 1) (manage 'new-environment 'combinators) (display 2)) environment))
1
;Loading "sdf/common/overrides.scm"... done
;Loading "sdf/common/utils.scm"... done
;Loading "sdf/common/indexes.scm"... done
;Loading "sdf/common/collections.scm"... done
;Loading "sdf/common/memoizers.scm"... done
;Loading "sdf/common/predicates.scm"... done
;Loading "sdf/common/predicate-metadata.scm"... done
;Loading "sdf/common/applicability.scm"... done
;Loading "sdf/common/generic-procedures.scm"... done
;Loading "sdf/common/pretty-printer.scm"... done
;Loading "sdf/common/operators.scm"... done
;Loading "sdf/common/operations.scm"... done
;Loading "sdf/common/package.scm"... done
;Loading "sdf/common/predicate-counter.scm"... done
;Loading "sdf/common/simple-tests.scm"... done
;Loading "sdf/common/trie.scm"... done
;Loading "sdf/combinators/function-combinators.scm"... done
;Value: (combinators)

1 (user) => 
31


VIP:

do not edit these