On 29 Jun 2009, at 14:08, Raphael Collet wrote:
Module.link takes a URL as an argument, and guarantees that several calls to it with the same URL will only apply the corresponding functor once. So, provided that you don't refer to a given functor with distinct URLs, it will never be applied more than once with Module.link.

It appears there is some misunderstanding here. The behaviour you describe only happens if the same functor is linked multiple times in a single call of Module.link -- which would indeed be a strange thing to do. Module.link always creates a new module manager (http:// www.mozart-oz.org/documentation/system/node7.html#chapter.module), and a new module manager has no idea what functors have been linked by other module managers.

As a result, linking the same functor multiple times with *multiple calls of Module.link* will result in quasi multiple instances of its stateful data. That this is indeed the case is exemplified by the tutorial example I mentioned in my previous mail. This behaviour is also useful if the definition of the functor changed. However, if this behaviour is not intended then it results in bugs that are *very* hard to find.

What I was suggesting is a definition of Module.link/Module.apply, where multiple calls of these procedures always use the same module manager (see my previous mail for its definition). This approach would indeed result in the behaviour you described. I suggest to have both versions as part of Mozart itself.

Best
Torsten

--
Torsten Anders
Interdisciplinary Centre for Computer Music Research
University of Plymouth
Office: +44-1752-586219
Private: +44-1752-558917
http://strasheela.sourceforge.net
http://www.torsten-anders.de



_________________________________________________________________________________
mozart-users mailing list                               
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users

Reply via email to