Paul Dufresne writes:
 > Hi! As a new OZ 'wannabe', I am reading the different tutorials for OZ,
 > and
 > while trying to do the first example of the Application programming
 > tutorial, I
 > have come to the following problem:
 > 
 > [EMAIL PROTECTED]:~$ ozc -c Webget.oz -o Webget.oza Mozart Compiler 1.3.1
 > (20050914) playing Oz 3
 > 
 > %%% feeding file Webget.oz
 > 
 > %********************** static analysis error *******************
 > %**
 > %** illegal arity in application
 > %**
 > %** Arity found:          1
 > %** Expected:             0
 > %** Application (names):  {Copy _}
 > %** Application (values): {<P/0> _<optimized>}
 > %** in file "./Webget.oz", line 27, column 2
 > %** ------------------ rejected (1 error)
 > [EMAIL PROTECTED]:~$
 > 
 > I have found that replacing the definition of proc {Copy} ... to proc
 > {Copy $}
 > does fix this problem.


I think you must have mistranscribed the code.  I have attached the code
for Webget.oz and it works fine for me.
 > 
 > I am not sure if it should be correctly run with proc {Copy} or if the
 > tutorial
 > should be changed. Also, a brief note advising against trying to
 > evaluate inside
 > OPI would be a good idea.
 > 

Hmmm, maybe.  But the section is very explicit about compiling with
ozc and running with ozengine.

Hope this helps,
k

functor
import
   Application
   Open
define
   Args = {Application.getArgs record('in'(single type:string)
                                      'out'(single type:string))}
   Status = try
               I={New Open.file init(url:  Args.'in')}
               O={New Open.file init(name: Args.'out'
                                     flags:[write create truncate])}
            in
               local
                  proc {Copy}
                     S={I read(list:$)}
                  in
                     if S\="" then
                        {O write(vs:S)} {Copy}
                     end
                  end
               in
                  {Copy}
               end
               0
            catch _ then 1
            end
   {Application.exit Status}
end

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

Reply via email to