guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fwd: Guile interpeter crash


From: Mark H Weaver
Subject: Re: Fwd: Guile interpeter crash
Date: Tue, 01 Oct 2013 16:34:22 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Panicz Maciej Godek <address@hidden> writes:

> ---------- Forwarded message ----------
> From: Panicz Maciej Godek <address@hidden>
> Date: 2013/10/1
> Subject: Re: Guile interpeter crash
> To: Dmitry Bogatov <address@hidden>
>
> 2013/10/1 Dmitry Bogatov <address@hidden>
>
>     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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]