[developers] Aligned generation?

Stephan Oepen oe at ifi.uio.no
Mon Jul 12 23:15:12 CEST 2010


hi berthold,

> today, I tried out the aligned generation code (feature arboretum) with
> HaG. I extracted appropriate settings from the arboretum.lsp source
> code. (e.g. debug settings, best first generation, no packing, scoring
> hook ...).
> 
> I also loaded any lisp source where the :arboretum feature is
> mentioned. 
> 
> Unfortunately, I could not get anything to generate in this mode. 
> Looking at the generator chart, I found that 
> 
> a) no triggered lexical entries were present (although a priority was
> set by the arboretum code)
> 
> b) many lexical rules and inflection rules failed to get applied
> 
> BTW: The very same behaviour can be observed, by merely setting
> *gen-first-only-p* to non-nil, e.g. without loading any arboretum code. 

this turned out a subtle and somewhat interesting bug; thus, i copy the
`developers' list.

some while ago, i had rewritten part of the chart initialization in the
generator.  from

  (dolist (...)
    (let ((edge ...))
      (with-agenda ... (... edge))))

to:

  (loop
     for ...
     for edge = ...
     do (with-agenda ... (... edge)))

much easier to read, obviously :-).  however, in best-first generation,
the with-agenda() macro creates a closure over the lexical binding for
.edge.  it turns out that loop() does not create a new lexical binding
in each iteration; hence by the time the closure is retrieved from the
agenda and funcall()ed, the value of .edge. may have changed.  for all
i recall, john had run into a similar problem using dolist() some time
ago, so for the (dwindling group of) lisp programmers among us, there
may be a lesson to be remembered here.

i just fixed the code in the LOGON tree and rebuilt binaries.  could i
ask you to give this a shot and report back to me in case you see more
problems.  if not, i will propagate the code change into the LKB trunk
towards the end of the week.

                                                          best  -  oe

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++ Universitetet i Oslo (IFI); Boks 1080 Blindern; 0316 Oslo; (+47) 2284 0125
+++    --- oe at ifi.uio.no; stephan at oepen.net; http://www.emmtee.net/oe/ ---
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++



More information about the developers mailing list