D seems like a language with very high potential and I'm highly interested in what the future holds for it. I'm curious though, is there any discussion about including streams in D? The C++ streams have been of great help to me in the past and they seem a lot cleaner than using functions like printf
/writefln
or whatever.
STREAMS is a general, flexible programming model for UNIX system communication services. STREAMS defines standard interfaces for character input/output (I/O) within the kernel, and between the kernel and the rest of the UNIX system. The mechanism consists of a set of system calls, kernel resources, and kernel routines.
One method of classifying streams is through physical, hydrological, and biological characteristics. Using these features, streams can fall into one of three types: perennial, intermittent, and ephemeral. Definitions and characteristics of each stream type are provided in this Appendix.
Depending on its location or certain characteristics, a stream may be referred to by a variety of local or regional names. Long large streams are usually called rivers, while smaller, less voluminous and more intermittent streams are known as streamlets, brooks or creeks.
The definition of a stream is a steady movement or flow of liquid. An example of a stream is water pouring from a rain gutter during a storm. (computers) A steady flow of data. A flow of water in a channel or bed, as a brook, rivulet, or small river.
There's currently talk of deprecating the current std.stream design and rewriting it. Andrei Alexandrescu posted the interfaces for a proposed new design based on D2's ranges awhile back. Unfortunately the community is short on manpower and trying to get a whole bunch of other library support working, like networking, parallelism, database APIs, containers, etc. Streams are on the agenda, but not on the front burner.
Well the current streaming interface is in http://www.digitalmars.com/d/2.0/phobos/std_stream.html
But I think it will be refactored sometime.
D has a standard way to pass around thing like a file, a open network connection and stdout. (See other answers) It also has a standard way to convert a struct/object to a string (toString, unless it's been changed). Personally, that gets you all of the parts of C++ streams that I like. I would be opposed to adding the operator overloading stuff as it makes thing like separation of data and format nearly impossible.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With