Skip to content
Ingo Albrecht edited this page Jul 23, 2013 · 9 revisions

Some ideas for improving the I/O library...

Improved format

The I/O library provides the format module. In Gwydion Dylan, the format directives could handle more printf functionality than the implementation in Open Dylan.

It should be pretty straight forward to port over the code from Gwydion Dylan into the code from Open Dylan.

If the Gwydion Dylan repository is added locally as a remote on your Open Dylan repository, you can probably actually cherry-pick the commits with a bit of work so that the original authorship is maintained. (Or use git format-patch from the Gwydion repo, hand-edit, and apply to Open Dylan.)

The documentation, tests, and release notes should be updated.

Stream Locking

Currently, the streams library does not provide any automatic thread-safety locking, leaving such issues entirely to the user. Streams should at least be safe to use concurrently, regardless of additional issues such as write/flush atomicity. The (hopefully tiny) overhead is definitely justified. Using a <recursive-lock>, operational atomicity could be achieved with the same lock as thread safety.

  • Option #1: Make streams always lock their internal state (like almost anyone else does).
  • Option #2: Provide a locking wrapper stream class. (this would have to be used by standard-io to be useful). This is more of a hacky workaround.

Simplifying Module Imports

Currently, people end up importing several modules just to be able to force-output on *standard-output*. This structure needs to be simplified.

The modules involved here are:

  • format
  • format-out
  • streams
  • standard-io

Proposals in this area are welcome.

  • Proposal #1: The format-out library should provide a corresponding flush-out function. This eliminates the need for standard-io and streams for most people.
  • Proposal #2: Provide a message-out function or similar that combines format-out and force-out. This covers 90% of format-out usages and would also be able to lock the stream properly.

File size and seek limits

The file APIs are specified in terms of <integer> which is too limited for 32 bit platforms:

define function unix-read
    (fd :: <integer>, data :: <buffer>, offset :: <integer>, count :: <integer>) => (result :: <integer>)
define function unix-write
    (fd :: <integer>, data, offset :: <integer>, count :: <integer>) => (result :: <integer>)
define function unix-lseek
    (fd :: <integer>, position :: <integer>, mode :: <integer>) => (position :: <integer>)
Clone this wiki locally