[Gd-hackers] With-open-file in Open Dylan
Gareth Baker
g.j.baker at dl.ac.uk
Thu May 3 16:29:13 CEST 2007
Thanks for the hints - I can get it to work now.
General question - Other than wading through the library files, is there an
easy way to determine which library and module needs 'using'? For
'with-open-file' the old Harlequin Dylan/Open Dylan documentation on the
web site seems to indicate that the library is 'io' and the module is
'streams'!
Anyway - thanks again
Gareth Baker
On 3/5/07 14:49, "Peter S. Housel" <housel at acm.org> wrote:
> 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,
More information about the hackers
mailing list