Stream

From Esolang
Jump to navigation Jump to search

In computer science, a stream is a channel via which the program communicates with the user and vice versa. They are typically interacted with via a Command Line Interface.

Standard streams

There are three standard streams:

  • Stdin: The user's input to the program.
  • Stdout: The output from the program to the user.
  • Stderr: The output directory when an error is encountered (typically shown in red (?)).

Stdin is typically where the user types into the console. The program takes the input from the console, and may or may not do something about the input

Stdout is typically referenced via print or equivalent command. Print("Hello, world!") will append the string "Hello, world!" to stdout. Whether "Hello, world!" has a trailing newline is language-dependent.

Stderr is effectively where the program complains to either the User or the Programmer, depending on who is currently using it. This it typically shown in the stdout and may even be indistinguishable from the stdout, though it is sometimes displayed in red text.

Nonstandard streams

Nonstandard streams are the streams that are defined by the programmer, not the OS or language. These include things like entries in GUIs and other programmer-defined (or, in builders, user-defined) input and output sources. Also in the nonstandard streams are socketry-related components, such as an input socket or an output socket. A socket with extra functions defined for it may even perform the role of a higher-level stream, such as ircin and ircout (received and sent messages in an irc server or client). The total possible nonstandard streams are too numerous to list here.

#Esoteric extended standard streams

The #esoteric irc channel on freenode defined some additional standard streams for use by the program. These are:

  • Stderrin
  • Stdyay
  • Stdyayin

The way each of these should be presented to the user is undefined, though stdyay is recommended to be shown just like stderr and stdout.

Stderrin is to stderr as stdin is to stdout. Stderrin is a way for the user to complain to the program when it makes an error, the same way a program complains to the user when they commit an error (some may argue it is the program's error that the user can do something to make an error, but this is simply false). Text is typed from the keyboard and displayed in red.

Stdyay is the inverse of stderr, it is a way for the program to announce happiness, for example when what usually causes an error does not. Text printed to stdyay is often shown in green.

Stdyayin is to stdyay as stderrin is to stderr. It is a way for the user to praise the program for its good work. It is often connected to a socket that interfaces with the lead programmer's Personal Praise Web API.

Esoteric streams

The Esoteric streams are a set of streams with undefined usage. There is an esoteric stream that corresponds to each standard and #esoteric extended standard stream, but what exactly they do varies from implementation to implementation at the moment (any user with a good enough idea is free to edit this article to have a fixed definition for each).

The esoteric streams are:

  • Esoin
  • Esoout
  • Esoerr
  • Esoerrin
  • Esoyay
  • Esoyayin

These each correspond to their obvious counterparts, but do something weird (that none of the others do).

Utility streams

Special-purpose languages, languages with too much content, and libraries may have several "Utility streams" that perform special purposes. They may not be named the way they will be here, as this is just an arbitrary list of possible streams. Some of these were mentioned above in Non-standard streams.

  • File: A file on the user's computer
  • Socket: a vector via which data can be sent and received between computers via the Internet
  • Webin: Data obtained from the web (via GET or a similar request)
  • Webout: Data sent to the web (via POST or a similar request)
  • Ircin: Received messages via IRC
  • Ircout: Sent messages via IRC
  • Skypein: Received messages via Skype
  • Skypeout: Received messages via Skype
  • Entry: In GUIs, this is a text input
  • Label: In GUIs, this is a text label
  • Canvas: In GUIs, this is essentially a picture that can be drawn by the program. A sort of scripted MS-Paint application that the user can't modify (unless directly programmed to allow them to)