One additional comment regarding this: The first definition in your example, Tommi, isn't required. The order of the definitions don't matter as long as a variable reference isn't required to compute the value being defined. In your case, the variable references aren't resolved until the procedures are executed. Meanwhile the bindings my-proc and fw-proc get their values just fine without a need to resolve the reference to fw-proc inside my-proc.
On Fri, Nov 1, 2024 at 2:21 PM Thompson, David <dthomps...@worcester.edu> wrote: > Hi Tommi, > > On Thu, Oct 31, 2024 at 10:30 PM Tommi Höynälänmaa > <tommi.hoynalan...@gmail.com> wrote: > > > > Suppose that I have the following code in a Guile module: > > --- > > (define fw-proc #f) > > > > (define (my-proc x) > > (display (fw-proc x))) > > > > (define (fw-proc x) > > (cons x x)) > > --- > > > > Can I declare the module as declarative? > > Yes, this is fine. If you put this in a module file and compile it, > Guile does not issue any warnings. `define` is not `set!`. (Modules > are declarative by default, btw.) > > - Dave > >