Opened 9 years ago

Closed 9 years ago

Last modified 8 years ago

#209 closed task (fixed)

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

Reported by: jeronimo Owned by: felix
Priority: minor Milestone:
Component: expander Version: 4.5.x
Keywords: Cc: ashinn
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 9 years ago by felix

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 9 years ago by felix

  • Cc ashinn added
  • Component changed from unknown to expander
  • Milestone changed from 4.5.0 to 4.6.0
  • Owner set to felix
  • Status changed from new to accepted
  • Type changed from defect to task

I consulted Alex and will make

(define define ...)

and

(define-syntax define-syntax ...)

signal an error.

comment:3 Changed 9 years ago by felix

  • Version set to 4.5.x

comment:4 follow-up: Changed 9 years ago by felix

  • Resolution set to fixed
  • Status changed from accepted to closed

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 9 years ago by felix

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 8 years ago by felix

  • Milestone 4.6.0 deleted

Milestone 4.6.0 deleted

Note: See TracTickets for help on using tickets.