samth/test-bugs — Issue #132: Internal definitions don't seem to follow specification
Author: racket-bug-submit
Created: 2012-03-09 00:58:12+00:00
State: open
Labels: anon-submit, gnats-migrated, racket

###### Originally submitted by Eric Dobson on: Sun Oct 02 21:20:01 -0400 2011

The documentation says that in an internal definition context when a define-values is encountered that the remaining body forms are enhanced with that binding, but I think this example shows otherwise. I believe that the some part of the next form is not enriched until after all of the forms are partially expanded.

I believe that the following program should output 4 4 4 4, but it outputs 5 5 4 4 for me.

##### Steps to Reproduce:

```racket
#lang racket

(define-syntax (make-bind-to-5 stx)
(syntax-case stx ()
((_ id later)
#'(define-syntax (later stx)
(syntax-case stx ()
((_ body)
(with-syntax ((new-id (syntax-local-introduce #'id)))
#'(let ((new-id 5))
body))))))))

(let ()
(make-bind-to-5 five later)
(let ()
(define five 4)
(later five)))

(let ()
(make-bind-to-5 five later)
(let ()
(define-syntax (five stx) #'4)
(later five)))

(let ()
(make-bind-to-5 five later)
(let ()
(define five 4)
(#%expression
(later five))))

(let ()
(make-bind-to-5 five later)
(let ()
(define-syntax (five stx) #'4)
(#%expression
(later five))))
```

##### Release:

5.1.3.11--2011-09-30(e650764/g)

##### Environment:

macosx "Darwin eric-dobsons-macbook.local 11.1.0 Darwin Kernel Version 11.1.0: Tue Jul 26 16:09:02 PDT 2011; root:xnu-1699.22.81~1/RELEASE_I386 i386" (x86_64-macosx/3m) (get-display-depth) = 32
Human Language: english
(current-memory-use) 237165768
Links: (links) = ("rudybot" "raco-git"); (links #:user? #f) = (); (links #:root? #t) = (); (links #:user? #f #:root? #t) = ()

Collections:
("/Users/eric/Library/Racket/5.1.3.11/collects"
("info-domain"))
("/Users/eric/proj/racket/plt/collects"
(".gitignore" "2htdp" "algol60" "at-exp" "browser" "combinator-parser" "compiler" "config" "data" "datalog" "db" "defaults" "deinprogramm" "drracket" "drscheme" "dynext" "embedded-gui" "eopl" "errortrace" "ffi" "file" "framework" "frtime" "games" "graphics" "gui-debugger" "guibuilder" "handin-client" "handin-server" "help" "hierlist" "honu" "htdp" "html" "icons" "info-domain" "lang" "launcher" "lazy" "macro-debugger" "make" "meta" "mred" "mrlib" "mysterx" "mzcom" "mzlib" "mzscheme" "net" "openssl" "parser-tools" "picturing-programs" "plai" "planet" "plot" "preprocessor" "profile" "r5rs" "r6rs" "racket" "racklog" "rackunit" "raco" "reader" "readline" "redex" "repo-time-stamp" "rnrs" "s-exp" "scheme" "schemeunit" "scribble" "scribblings" "scriblib" "setup" "sgl" "sirmail" "slatex" "slideshow" "srfi" "srpersist" "stepper" "string-constants" "swindle" "syntax" "syntax-color" "teachpack" "test-box-recovery" "test-engine" "tests" "tex2page" "texpict" "trace" "typed" "typed-racket!
" "typed-scheme" "unstable" "version" "waterworld" "web-server" "wxme" "xml" "xrepl"))

Computer Language: (("Determine language from source") (#(#t print mixed-fraction-e #f #t none) (default) #() "#lang racket\n" #f #f))

###### This bug was converted from Gnats bug [12251](http://bugs.racket-lang.org/old/12251).

[anon-submit eric.n.dobson AT gmail.com]