From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Zefram Newsgroups: gmane.lisp.guile.bugs Subject: bug#16363: interactive use subject to compiler limitations Date: Sun, 5 Jan 2014 23:17:59 +0000 Message-ID: <20140105231759.GH30283@fysh.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1388967674 19134 80.91.229.3 (6 Jan 2014 00:21:14 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 6 Jan 2014 00:21:14 +0000 (UTC) To: 16363@debbugs.gnu.org Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Mon Jan 06 01:21:19 2014 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VzxwU-0004WW-MW for guile-bugs@m.gmane.org; Mon, 06 Jan 2014 01:21:18 +0100 Original-Received: from localhost ([::1]:59930 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VzxwU-000671-64 for guile-bugs@m.gmane.org; Sun, 05 Jan 2014 19:21:18 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52074) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VzxNf-0005yH-6e for bug-guile@gnu.org; Sun, 05 Jan 2014 18:45:20 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VzxNb-0002Sx-8m for bug-guile@gnu.org; Sun, 05 Jan 2014 18:45:19 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:51446) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VzxNb-0002St-5S for bug-guile@gnu.org; Sun, 05 Jan 2014 18:45:15 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1VzxNa-00052o-Pl for bug-guile@gnu.org; Sun, 05 Jan 2014 18:45:15 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Zefram Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Sun, 05 Jan 2014 23:45:14 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 16363 X-GNU-PR-Package: guile X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-guile@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.138896546619202 (code B ref -1); Sun, 05 Jan 2014 23:45:14 +0000 Original-Received: (at submit) by debbugs.gnu.org; 5 Jan 2014 23:44:26 +0000 Original-Received: from localhost ([127.0.0.1]:37211 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VzxMn-0004zX-Ff for submit@debbugs.gnu.org; Sun, 05 Jan 2014 18:44:25 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:47307) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VzwxK-0004Fg-M1 for submit@debbugs.gnu.org; Sun, 05 Jan 2014 18:18:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VzwxJ-00053I-HM for submit@debbugs.gnu.org; Sun, 05 Jan 2014 18:18:06 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:48183) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VzwxJ-00053E-ER for submit@debbugs.gnu.org; Sun, 05 Jan 2014 18:18:05 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49027) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VzwxI-0008Ml-FW for bug-guile@gnu.org; Sun, 05 Jan 2014 18:18:05 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VzwxH-000530-A2 for bug-guile@gnu.org; Sun, 05 Jan 2014 18:18:04 -0500 Original-Received: from river.fysh.org ([2001:41d0:8:d47f::2]:52401) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VzwxH-00052w-3l for bug-guile@gnu.org; Sun, 05 Jan 2014 18:18:03 -0500 Original-Received: from zefram by river.fysh.org with local (Exim 4.80 #2 (Debian)) id 1VzwxD-0000o2-KG; Sun, 05 Jan 2014 23:17:59 +0000 Content-Disposition: inline X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Mailman-Approved-At: Sun, 05 Jan 2014 18:44:19 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-Mailman-Approved-At: Sun, 05 Jan 2014 19:21:11 -0500 X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Original-Sender: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.bugs:7369 Archived-At: guile-2.0.9's compiler has some inconvenient restrictions, relative to its interpreter. Where the compiler is automatically applied to scripts, the restrictions aren't a serious problem, because if compilation fails then guile falls back to interpreting the script. But in an interactive REPL session, by default each form entered by the user is passed through the compiler, and if compilation fails then the error is signalled, with no fallback to interpretation. As a test case, consider a form in which a procedure object appears. The compiler can't handle forms that directly reference a wide variety of object types, including procedures (both primitive and user-defined) and GOOPS objects. In the interpreter these objects simply self-evaluate, and it can be useful to reference them without the usual indirection through a named variable. Here I'll show what happens to such a form in a script and interactively, in guile 1.8 and 2.0: $ cat t2 (cond-expand (guile-2 (eval-when (compile load eval) (fluid-set! read-eval? #t))) (else (fluid-set! read-eval? #t))) (define (p x y) (#.+ x y)) (write (p 2 3)) (newline) $ guile-1.8 t2 5 $ guile-2.0 --no-auto-compile t2 5 $ guile-2.0 t2 ;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0 ;;; or pass the --no-auto-compile argument to disable. ;;; compiling /home/zefram/usr/guile/t2 ;;; WARNING: compilation of /home/zefram/usr/guile/t2 failed: ;;; ERROR: build-constant-store: unrecognized object # 5 $ guile-1.8 guile> (fluid-set! read-eval? #t) guile> (define (p x y) (#.+ x y)) guile> (p 2 3) 5 guile> ^D $ guile-2.0 GNU Guile 2.0.9-deb+1-1 Copyright (C) 1995-2013 Free Software Foundation, Inc. Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'. This program is free software, and you are welcome to redistribute it under certain conditions; type `,show c' for details. Enter `,help' for help. scheme@(guile-user)> (fluid-set! read-eval? #t) scheme@(guile-user)> (define (p x y) (#.+ x y)) While compiling expression: ERROR: build-constant-store: unrecognized object # scheme@(guile-user)> (p 2 3) :3:0: In procedure #:3:0 ()>: :3:0: In procedure #:3:0 ()>: Unbound variable: p There is a workaround for this problem: the REPL's "interp" option controls whether forms go through the compiler or the interpreter. Hence: scheme@(guile-user)> (fluid-set! read-eval? #t) scheme@(guile-user)> (#.+ 2 3) While compiling expression: ERROR: build-constant-store: unrecognized object # scheme@(guile-user)> ,o interp #t scheme@(guile-user)> (#.+ 2 3) $1 = 5 So the problem is merely that the REPL is broken *by default*. It should either default to the working mechanism, or fall back to it when compilation fails (as the file auto-compilation does). Debian incarnation of this bug report: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=734108 -zefram