Re: [Gauche-devel] redefining "define" does not result in an error
R7RS Scheme scripting engine
Status: Beta
Brought to you by:
shirok
|
From: Shiro K. <sh...@la...> - 2010-07-22 00:27:13
|
Strictly speaking, it's not a descrepancy; "error" in R5RS merely means "it's not a valid R5RS program". What happens when an implementation encounters an erroneous code is entirely up to the implementation. It can raise an exception, crash, handle it gracefully, or handle it with additional semantics as an extention of the language. In this particular case, the problem is that if the syntactic keyword is redefined in the middle of the program, there can be different interpretations of the code. Personally I think an implementation should allow me to shoot myself if I wish, so I might make this case issue a warning (just like redefining a constant - which may break semantics of already-compiled code, but you may want to do so sometimes, knowing the risk.) --shiro From: Dek...@Ya... (Benjamin L. Russell) Subject: [Gauche-devel] redefining "define" does not result in an error Date: Thu, 22 Jul 2010 07:48:18 +0900 > In Gauche 0.9, redefining "define" does not result in an error, > contradicting Section 5.3 of the "Revised^5 Report on the Algorithmic > Language Scheme" (see > http://www.schemers.org/Documents/Standards/R5RS/HTML/r5rs-Z-H-8.html); > _viz._: > > gosh> (define define 3) > define > gosh> define > 3 > gosh> (define first car) > *** ERROR: invalid application: (3 #0=#<subr car> #0#) > Stack Trace: > _______________________________________ > gosh> > > Section 5.3 specifically states the following: > >> ... 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.... For example, the following are errors: >> >> (define define 3) > > Perhaps this discrepancy should be resolved. > > -- Benjamin L. Russell > -- > Benjamin L. Russell / DekuDekuplex at Yahoo dot com > http://dekudekuplex.wordpress.com/ > Translator/Interpreter / Mobile: +011 81 80-3603-6725 > "Furuike ya, kawazu tobikomu mizu no oto." -- Matsuo Basho^ > > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by Sprint > What will you do first with EVO, the first 4G phone? > Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first > _______________________________________________ > Gauche-devel mailing list > Gau...@li... > https://lists.sourceforge.net/lists/listinfo/gauche-devel |