Summary

Chicken allows for shadowing syntax in a way disallowed by R5RS/sec.5.3

Metadata

Description

Hi,

With master/HEAD, (latest commit is 8acb3f92df82f369fc5dbef8f7c44a68468a92c3):

 #;7> (define define (lambda () 'z))
 #;8> define
 #<procedure (define)>
 #;9> (define)
 
 Error: (car) during expansion of (define ...) - bad argument type: ()
 
     Call history:
 
     <syntax>        (define)    <-- 
 #;9> (let ((a define)) (a))
 z
 #;10> 

But section 5.3 of R5RS explicitly disallows defining define among other things (it mentions "(define define 3)" as an example of error, and Chicken allows it).

This is not listed in the "Deviations form the standard" section of the manual, so it's not clear if it's a bug or an intended deviation.

P.S.: Bigloo does the same; Chibi signals an error; Guile shadows the define syntax even when it's in procedure-calling position: "(define)" above works in Guile and returns the symbol z!

Changes and comments

[2010-04-13 13:48:33 UTC] felix wrote:

Yes, this is an error, but the implementation is free to handle it in whatever way it likes (at least that is my understanding of the term "is an error").

I will add a note to the manual that describes the current behaviour.

[2010-04-15 14:07:22 UTC] felix changed status from new to accepted

[2010-04-15 14:07:22 UTC] felix set cc to ashinn

[2010-04-15 14:07:22 UTC] felix changed component from unknown to expander

[2010-04-15 14:07:22 UTC] felix changed milestone from 4.5.0 to 4.6.0

[2010-04-15 14:07:22 UTC] felix set owner to felix

[2010-04-15 14:07:22 UTC] felix changed type from defect to task

[2010-04-15 14:07:22 UTC] felix wrote:

I consulted Alex and will make

 (define define ...)

and

 (define-syntax define-syntax ...)

signal an error.

[2010-04-15 14:08:54 UTC] felix set version to 4.5.x

[2010-04-27 15:23:19 UTC] felix changed status from accepted to closed

[2010-04-27 15:23:19 UTC] felix set resolution to fixed

[2010-04-27 15:23:19 UTC] felix wrote:

See 9fd71180ce4c45d5b81051f1e942ef135450a9f8 and d318031ff9305bd43be631f5f4f2c6b4a282c15a (master).

This implements the changes noted in the last comment and is sufficient, IMHO.

[2010-04-27 15:23:39 UTC] felix wrote:

Replying to felix: > See 9fd71180ce4c45d5b81051f1e942ef135450a9f8 and d318031ff9305bd43be631f5f4f2c6b4a282c15a (master). > > This implements the changes noted in the last comment and is sufficient, IMHO. >

(experimental branch, not master).

[2011-04-04 08:31:00 UTC] felix removed milestone 4.6.0

[2011-04-04 08:31:00 UTC] felix wrote:

Milestone 4.6.0 deleted