-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
consistent design of streams, strings and their interfaces #51
Comments
The only stream we have AFAIK is |
True for the moment, but you could certainly generate characters using some other process that isn't an
Nowhere does one require the string to be escaped to be indexable by integers — it can just produce them one at a time. Part of the reason I opened this pair of issues was to figure out these distinctions. Some things are iterable, others are indexable; some can be iterated forward and backwards, some only forwards. Also, note that indexing through a string using an index |
The real "stream" part of this example is the printing --- it writes to a global current output stream which has implicit state. There will always be a choice between storing bytes into an array and going through streams. The former has lower overhead for small data, and the latter can avoid using temporary memory when ultimately writing to an I/O device. There are three concepts: indexable (string), stream, and iterable. Indexable implies iterable. A stream is neither indexable nor iterable, but can be wrapped in an iterator such as |
You mean a stream as in a literal |
No, I do imagine an abstract Stream of which IOStream is an instance. But given that abstract types for Indexable and Iterable don't exist either, this isn't a big deal. If/when we add multiple inheritance, all of these would become formal types. Until then we can talk about all of them in terms of interfaces (which exist, but aren't declared). |
Was there a typo in the issue number? |
Uh, yeah. Sorry. |
We decided there's nothing to do here. |
* force explicit init using `init` for local env * remove try catch, other small fixes
* Explicitly convert to `Vector()` for 0.7 compatibility * Quash 0.7 errors * Add Compat dependency and `global nerrors` everywhere * Add `codeunits(x) = x` shim for Julia 0.6.x
…pwarnings bob: Fix isupper deprecation warnings (Fixes JuliaLang#32)
Add fit method
Check output type of `prepare_call` more carefully. Fixes #51.
This overlaps somewhat with issue #50 in that streams and strings can be viewed as collections that contain characters. However, it seems worth making a separate issue. We currently also make no distinction between streams of characters and strings, but there is a major difference: a stream can only be iterated forwards, while a string provides random access. Many of our string operations could actually be stream operations, thereby allowing much more efficient usage in cases where the data is being read incrementally.
The text was updated successfully, but these errors were encountered: