[Gd-hackers] With-open-file in Open Dylan

Gareth Baker g.j.baker at dl.ac.uk
Thu May 3 11:14:08 CEST 2007


I've downloaded Open Dylan Beta4 for Mac OSX and have got 'hello-world'
running on my new intel MacBook.

I'm working on a program which reads text files and am having problems with
using 'with-open-file'

The following fairly simple code gives and error:

Module:    aftox

define method aftox-main()
  format-out("hello there!\n");

  with-open-file (fs = "foo.text", element-type: <byte>)
    read-to-end(fs)
  end;
end method say-hello;

aftox-main();

// eof

Library file:

Module:    dylan-user

define library hello-world
  use io;
  use common-dylan;
  export hello-world;
end library;

define module hello-world
  use common-dylan;
  use streams;
  use simple-io;
end module;

// eof

Compiling with the command 'opendylan -build aftox.lid' gives an error:

Serious warning at aftox:12:

Unexpected token "read-to-end".

aftox:11:     -----------
aftox:12:     read-to-end(fs)
aftox:13:     -----------

(there is a lot more output).

Can anyone see what the problem is?

Thanks
Gareth Baker

<no good dylan signature>




More information about the hackers mailing list