[Gd-hackers] With-open-file in Open Dylan
Peter S. Housel
housel at acm.org
Thu May 3 15:49:00 CEST 2007
On Thu, 2007-05-03 at 10:14 +0100, Gareth Baker wrote:
> 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;
> 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>
>
>
> define module hello-world
> use common-dylan;
> use streams;
> use simple-io;
> end module;
>
> // eof
1. You need to provide a definition for the library named in
your lid file, and for the aftox module, in your library file.
2. You need to import the system library into your library.
3. You need to import the file-system module into the aftox
module, since that's where \with-open-file is defined.
Cheers,
--
Peter S. Housel <housel at acm.org>
More information about the hackers
mailing list