* Guile interpeter crash @ 2013-10-01 15:15 Dmitry Bogatov [not found] ` <CAMFYt2avxvU_Vd-oBObtNq43qaU9wCLq=K=AHaLWJMmvrzq=pA@mail.gmail.com> 0 siblings, 1 reply; 4+ messages in thread From: Dmitry Bogatov @ 2013-10-01 15:15 UTC (permalink / raw) To: guile-devel [-- Attachment #1: Type: text/plain, Size: 1136 bytes --] Here is code that results crash (return 134). Hope it is interesting. guile (GNU Guile) 2.0.9 Copyright (C) 2013 Free Software Foundation, Inc. (define *define-count* 0) (define-syntax define# (syntax-rules () ((_ obj ...) (begin (set! *define-count* (1+ *define-count*)) (define obj ...))))) (define-syntax define (syntax-rules () ((_ obj ...) (define# obj ...)))) (define# foo 2) (display *define-count*) $ guile --no-auto-compile crash.scm Backtrace: In ice-9/psyntax.scm: 976: 19 Aborted $ guile --auto-compile crash.scm ;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0 ;;; or pass the --no-auto-compile argument to disable. ;;; compiling /share/home/kaction/build/crash.scm ;;; WARNING: compilation of /share/home/kaction/build/crash.scm failed: ;;; ERROR: Throw to key `vm-error' with args `(vm-run "VM: Stack overflow" ())'. aborted -- Best regards, Dmitry Bogatov <KAction@gnu.org>, Free Software supporter and netiquette guardian. git clone git://kaction.name/rc-files.git --depth 1 GPG: 54B7F00D Html mail and proprietary format attachments are forwarded to /dev/null. [-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --] ^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <CAMFYt2avxvU_Vd-oBObtNq43qaU9wCLq=K=AHaLWJMmvrzq=pA@mail.gmail.com>]
* Fwd: Guile interpeter crash [not found] ` <CAMFYt2avxvU_Vd-oBObtNq43qaU9wCLq=K=AHaLWJMmvrzq=pA@mail.gmail.com> @ 2013-10-01 16:42 ` Panicz Maciej Godek 2013-10-01 20:34 ` Mark H Weaver 0 siblings, 1 reply; 4+ messages in thread From: Panicz Maciej Godek @ 2013-10-01 16:42 UTC (permalink / raw) To: guile-devel [-- Attachment #1: Type: text/plain, Size: 1182 bytes --] ---------- Forwarded message ---------- From: Panicz Maciej Godek <godek.maciek@gmail.com> Date: 2013/10/1 Subject: Re: Guile interpeter crash To: Dmitry Bogatov <KAction@gnu.org> 2013/10/1 Dmitry Bogatov <KAction@gnu.org> > > Here is code that results crash (return 134). Hope it is interesting. > The code you gave is not a proper Scheme program. C.f. http://www.schemers.org/Documents/Standards/R5RS/HTML/r5rs-Z-H-8.html#%_sec_5.3, excerpt: Although macros may expand into definitions and syntax definitions in any context that permits them, it is an error for a definition or syntax definition to shadow a syntactic keyword whose meaning is needed to determine whether some form in the group of forms that contains the shadowing definition is in fact a definition, or, for internal definitions, is needed to determine the boundary between the group and the expressions that follow the group In other words, you cannot redefine define. I suppose the interpreter falls into infinite loop when it tries to substitute define# with define, and then define -- with define#. That being said, I don't think it's fortunate to use the # character within a symbol. Best regards, M. [-- Attachment #2: Type: text/html, Size: 2165 bytes --] ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Fwd: Guile interpeter crash 2013-10-01 16:42 ` Fwd: " Panicz Maciej Godek @ 2013-10-01 20:34 ` Mark H Weaver 2013-10-02 7:13 ` Dmitry Bogatov 0 siblings, 1 reply; 4+ messages in thread From: Mark H Weaver @ 2013-10-01 20:34 UTC (permalink / raw) To: Panicz Maciej Godek; +Cc: guile-devel Panicz Maciej Godek <godek.maciek@gmail.com> writes: > ---------- Forwarded message ---------- > From: Panicz Maciej Godek <godek.maciek@gmail.com> > Date: 2013/10/1 > Subject: Re: Guile interpeter crash > To: Dmitry Bogatov <KAction@gnu.org> > > 2013/10/1 Dmitry Bogatov <KAction@gnu.org> > > Here is code that results crash (return 134). Hope it is > interesting. > > The code you gave is not a proper Scheme program. > C.f. > http://www.schemers.org/Documents/Standards/R5RS/HTML/r5rs-Z-H-8.html#%_ > sec_5.3, excerpt: > > Although macros may expand into definitions and syntax definitions in > any context that permits them, it is an error for a definition or > syntax definition to shadow a syntactic keyword whose meaning is > needed to determine whether some form in the group of forms that > contains the shadowing definition is in fact a definition, or, for > internal definitions, is needed to determine the boundary between the > group and the expressions that follow the group > > In other words, you cannot redefine define. It can be done safely using the module system, by calling it something other than 'define' in the module, and then renaming it on export. For example, see: http://git.savannah.gnu.org/gitweb/?p=guile.git;a=blob;f=module/ice-9/curried-definitions.scm;h=fa369906ccd222b6aa2f3692f17638ca02eb2a41;hb=HEAD In practice, there are ways to redefine 'define' within the same module in Guile 2.0, but it depends on implementation details and might not be future proof. > That being said, I don't think it's fortunate to use the # character > within a symbol. Yes, it's probably best to avoid that character in symbols. The fact that it happens to work is a quirk of our reader, and is undocumented. For the documented characters that are allowed in symbols, see: http://www.gnu.org/software/guile/manual/html_node/Symbol-Read-Syntax.html Regards, Mark ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Fwd: Guile interpeter crash 2013-10-01 20:34 ` Mark H Weaver @ 2013-10-02 7:13 ` Dmitry Bogatov 0 siblings, 0 replies; 4+ messages in thread From: Dmitry Bogatov @ 2013-10-02 7:13 UTC (permalink / raw) To: Mark H Weaver; +Cc: guile-devel [-- Attachment #1: Type: text/plain, Size: 659 bytes --] Mark H Weaver <mhw@netris.org> writes: > It can be done safely using the module system, by calling it something > other than 'define' in the module, and then renaming it on export. For > example, see: > > http://git.savannah.gnu.org/gitweb/?p=guile.git;a=blob;f=module/ice-9/curried-definitions.scm;h=fa369906ccd222b6aa2f3692f17638ca02eb2a41;hb=HEAD Thanks! I already found working solution, but your is cleaner. -- Best regards, Dmitry Bogatov <KAction@gnu.org>, Free Software supporter and netiquette guardian. git clone git://kaction.name/rc-files.git --depth 1 GPG: 54B7F00D Html mail and proprietary format attachments are forwarded to /dev/null. [-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --] ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-10-02 7:13 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2013-10-01 15:15 Guile interpeter crash Dmitry Bogatov [not found] ` <CAMFYt2avxvU_Vd-oBObtNq43qaU9wCLq=K=AHaLWJMmvrzq=pA@mail.gmail.com> 2013-10-01 16:42 ` Fwd: " Panicz Maciej Godek 2013-10-01 20:34 ` Mark H Weaver 2013-10-02 7:13 ` Dmitry Bogatov
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).