Opened 14 years ago

Closed 14 years ago

Last modified 13 years ago

#209 closed task (fixed)

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

Reported by: Jeronimo Pellegrini Owned by: felix winkelmann
Priority: minor Milestone:
Component: expander Version: 4.5.x
Keywords: Cc: Alex Shinn
Estimated difficulty:

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!

Change History (6)

comment:1 Changed 14 years ago by felix winkelmann

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.

comment:2 Changed 14 years ago by felix winkelmann

Cc: Alex Shinn added
Component: unknownexpander
Milestone: 4.5.04.6.0
Owner: set to felix winkelmann
Status: newaccepted
Type: defecttask

I consulted Alex and will make

(define define ...)

and

(define-syntax define-syntax ...)

signal an error.

comment:3 Changed 14 years ago by felix winkelmann

Version: 4.5.x

comment:4 Changed 14 years ago by felix winkelmann

Resolution: fixed
Status: acceptedclosed

See 9fd71180ce4c45d5b81051f1e942ef135450a9f8 and d318031ff9305bd43be631f5f4f2c6b4a282c15a (master).

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

comment:5 in reply to:  4 Changed 14 years ago by felix winkelmann

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).

comment:6 Changed 13 years ago by felix winkelmann

Milestone: 4.6.0

Milestone 4.6.0 deleted

Note: See TracTickets for help on using tickets.