Skip to content

Add IO::Null object#16736

Draft
ysbaddaden wants to merge 1 commit intocrystal-lang:masterfrom
ysbaddaden:feature/io-null-object
Draft

Add IO::Null object#16736
ysbaddaden wants to merge 1 commit intocrystal-lang:masterfrom
ysbaddaden:feature/io-null-object

Conversation

@ysbaddaden
Copy link
Copy Markdown
Collaborator

@ysbaddaden ysbaddaden commented Mar 13, 2026

An IO object that does nothing (always empty, never writes), yet always succeeds. Can be used in place of a regular IO when there is nothing to read or the output shall be discarded, won't even close. Similar to /dev/null or equivalent.

NOTES:

  • implementation is dumb, docs are more complex (help wanted)
  • there could be an IO.null singleton

Kept as DRAFT, so we can discuss usefulness and refine.

See #16735 (comment)

An IO object that does nothing (always empty, never writes), yet always
succeeds. Can be used in place of a regular IO when there is nothing to
read or output shall be discarded.

Similar to "/dev/null" or equivalent.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant