Dear Gilmullin (is that spelling OK?),Please consider reading the Application Programming programming tutorial (http://www.mozart-oz.org/documentation/apptut/index.html), that explains the use of functors.
In contrast to concepts like packages in other programming language (e.g., Lisp, Java) the modules/functors in Oz are first class values. E.g., you can have a function that creates a functor on-the-fly. The "names" of functors are plain Oz variables. For a compiled functor without a "name", it defaults to an anonymous variable.
declare [List]= {Module.link ['/home/xxx/list.ozf']}
Such declaration would make the buildin functor List unaccessible -- not a good idea. You can better use a variable like List2, or ListUtils etc.
||declare '/home/xxx/list.ozf'
Oz makes a clear distinction between functors and modules (cf. the distinction between classes and objects, though this is certainly not the same). You cannot use a functor before linking/applying it first. Also, '/home/xxx/list.ozf' is a atom, not a variable. declare introduces variables, nothing else. I know what you mean by this line of code, but it is as nonsensical as, e.g.,
declare 1 % nonsense! Best Torsten On Jul 14, 2009, at 10:08 PM, Rusreg wrote:
Hello. Is there way to specify the 'default' name of functor? For example we have functor | functor export append:Append sort:Sort member:Member ... define proc {Append ... } ... end proc {MergeSort ...} ... end proc {Sort ... } ... {MergeSort ...} ... end proc {Member ...} ... end end || and it import in other module under name 'List': declare [List]= {Module.link ['/home/xxx/list.ozf']}||| I want declare functor as: |functor List ... and then use it with this name without specify the alias: ||declare '/home/xxx/list.ozf' ||In other world I want specify the module name. It is very natural (mostlanguages use such module system) and easy for use. PS The ideal for me use modules in traditional approach - specify the module name in import declaration, without specifying path to file: import List ... but there no information about this in documentation. |
-- 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
