[plt-scheme] Puzzled by procedure ordering.

From: Ferreira Maurizio (maurizio.ferreira at seling.it)
Date: Tue Oct 21 05:38:08 EDT 2008

In the following example, the procedure "Work" has no problem
in 'seeing the procedure "genproc".
However if I move the procedure in the indicated place, 
Drscheme complains with the following error:

reference to an identifier before its definition: work

Any explanation ?

Regards
Maurizio

#lang scheme/gui

(define (work x y)
  (let ((fun (genproc 3)))
    (display (fun 5))))

(define (genproc n)
   (lambda (x) (+ x n)))

(define frame (new frame% [label "test"]))
(define btok (new button% [parent frame] [label "ok"] [callback work]))

;; ---- move work here and get an error.

(send frame show #t)


Posted on the users mailing list.