Discussion:
[dart-misc] Dart Language and Library Newsletter (2017-10-27)
'Florian Loitsch' via Dart Misc
2017-10-28 02:14:49 UTC
Permalink
Github link for this newsletter:
https://github.com/dart-lang/sdk/blob/master/docs/newsletter/20171027.md

Earlier newsletters:
https://github.com/dart-lang/sdk/tree/master/docs/newsletter

Dart Language and Library Newsletter

Welcome to the Dart Language and Library Newsletter.
<https://github.com/dart-lang/sdk/blob/master/docs/newsletter/20171027.md#library-updates>Library
Updates

This week's newsletter is all about the planned library changes for Dart
2.0.

We have collected our plans in this document
<https://github.com/dart-lang/sdk/blob/master/docs/newsletter/lib/lib.md>.

Please let us know what you think.
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
Günter Zöchbauer
2017-10-28 14:06:30 UTC
Permalink
This all sounds great.

I'm wondering though if moving Point and Rectangle to dart:html would cause issues with packages that provide platform neutral functionality and now would need the user of the package to convert all such values between dart:html and the package version when passing them along.

If Stream provides more RX style methods, a flatMapLatest equivalent is IMHO worth considering.
There are of course a lot more that would be great to have, but I think that's quite a common one.
Github link for this newsletter: https://github.com/dart-lang/sdk/blob/master/docs/newsletter/20171027.md
Earlier newsletters: https://github.com/dart-lang/sdk/tree/master/docs/newsletter
Dart Language and Library Newsletter
Welcome to the Dart Language and Library Newsletter.
Library Updates
This week's newsletter is all about the planned library changes for Dart 2.0.
We have collected our plans in this document.
Please let us know what you think.
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
'Florian Loitsch' via Dart Misc
2017-10-30 13:52:32 UTC
Permalink
Post by Günter Zöchbauer
This all sounds great.
good to hear :)
Post by Günter Zöchbauer
I'm wondering though if moving Point and Rectangle to dart:html would
cause issues with packages that provide platform neutral functionality and
now would need the user of the package to convert all such values between
dart:html and the package version when passing them along.
Yes. We are definitely worried too.
It would really feel nice, if `dart:math` was just a bunch of constants and
functions. However, we might need to keep `Point` and `Rectangle` there...
If `dart:html` doesn't work (for the mentioned reasons), then there doesn't
seem to be a better place for them.
Post by Günter Zöchbauer
If Stream provides more RX style methods, a flatMapLatest equivalent is
IMHO worth considering.
There are of course a lot more that would be great to have, but I think
that's quite a common one.
We will consider it.
If I understand correctly (and Lasse is the one who really knows the
insides of Streams, this is basically just the equivalent of `asyncMap`
where the input stream isn't paused (and the output switches as soon there
is a new one).

So there would be multiple options:
- asyncMap(mapFun, switchLatest: true); // With a better named arg.
- asyncMapLatest(mapFun); // But "latest" isn't used anywhere else.
- something even better?

We already get pushback that there are too many methods on `Stream`, but we
will look into it.
Post by Günter Zöchbauer
https://github.com/dart-lang/sdk/blob/master/docs/newsletter/20171027.md
https://github.com/dart-lang/sdk/tree/master/docs/newsletter
Post by 'Florian Loitsch' via Dart Misc
Dart Language and Library Newsletter
Welcome to the Dart Language and Library Newsletter.
Library Updates
This week's newsletter is all about the planned library changes for Dart
2.0.
Post by 'Florian Loitsch' via Dart Misc
We have collected our plans in this document.
Please let us know what you think.
--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups
"Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
Istvan Soos
2017-10-30 14:21:14 UTC
Permalink
On Mon, Oct 30, 2017 at 2:52 PM, 'Florian Loitsch' via Dart Misc
Post by 'Florian Loitsch' via Dart Misc
Post by Günter Zöchbauer
I'm wondering though if moving Point and Rectangle to dart:html would
cause issues with packages that provide platform neutral functionality and
now would need the user of the package to convert all such values between
dart:html and the package version when passing them along.
Yes. We are definitely worried too.
It would really feel nice, if `dart:math` was just a bunch of constants and
functions. However, we might need to keep `Point` and `Rectangle` there...
If `dart:html` doesn't work (for the mentioned reasons), then there doesn't
seem to be a better place for them.
I believe these classes may also belong to a more geometry-focused
library that handles intersections, outer boundary boxes, and other
shapes like lines, triangles and 3D objects too. I'm not sure how that
would combine well with the 'dart:html' lib.

Istvan
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
tatumizer-v0.2
2017-10-30 20:26:52 UTC
Permalink
copy,
toList
new List.from(),
sublist.
Clearly, that's not a good idea. We are still investigating the best
solution to this problem. We like copy, *because it works for other
classes (like Map, Set and Queue*)
Opinion:

Yes, copy works for other classes, but not with start/end parameters. Maybe
it's better for the word to mean exactly what it means? :) Copy means
"copy".

As soon as you add start/end, it turns into sublist (and while reading, you
will have to do mental translation!). Then, to be consistent, one might
argue that 'substring' should be renamed to "copy", too :)

I don't think having 4 ways to create a copy constitutes a problem,
because 3 of them turn into 'copy' only in a degenerate case of more
general operation. E.g., there're always many ways to write number zero:

x=0 or x=y-y or etc... - should we really ban subtraction based on this
observation?

/Opinion
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
tatumizer-v0.2
2017-10-31 00:52:35 UTC
Permalink
I think the whole terminology based on words 'Broadcast' and
'single-subscription' is unfortunate. It's not intuitive IMO. In
particular, the name 'single-subscription' doesn't logically imply that the
stream has memory, as opposed to Broadcast streams with no memory.
And moreover, it's not obvious that the whole set of operations is complete
for the purposes of building an arbitrary configuration of connections.
Even if it is, then the mental model would be quite complicated, unless we
introduce more 'words'
Opinion:
My conjecture is that the more intuitive model can be based on the
following:
1. Stream cannot have more than 1 subscriber during lifetime (no 'broadcast
streams' in their current form)
2. We define 3 words: Transformer, Splitter, Accumulator.

Accumulator is what current single-subscription stream is (it has memory,
unlike other streams - this is why it's called Accumulator)
Splitter splits the stream into N separate streams, each of which has the
life of its own
Transformer is similar to what we have today.

The advantage - if one has a clear picture of the desired topology of
connections in their head, it's trivial to express it using the above terms.
/Opinion
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
tatumizer-v0.2
2017-10-31 17:24:09 UTC
Permalink
Correction: Accumulator -> Buffer Tank, or simply Tank (that's how it's
called elsewhere)
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
'Florian Loitsch' via Dart Misc
2017-11-07 15:25:17 UTC
Permalink
Post by tatumizer-v0.2
copy,
toList
new List.from(),
sublist.
Clearly, that's not a good idea. We are still investigating the best
solution to this problem. We like copy, *because it works for other
classes (like Map, Set and Queue*)
Yes, copy works for other classes, but not with start/end parameters.
Maybe it's better for the word to mean exactly what it means? :) Copy means
"copy".
One of the reasons we want to add `copy` is because it also makes
`subbuffer` unnecessary (in the ByteBuffer class of dart:typed_data). If we
remove `start`/`end` we need to think about that method again...
Post by tatumizer-v0.2
As soon as you add start/end, it turns into sublist (and while reading,
you will have to do mental translation!). Then, to be consistent, one might
argue that 'substring' should be renamed to "copy", too :)
That's something we actually considered.
Post by tatumizer-v0.2
I don't think having 4 ways to create a copy constitutes a problem,
because 3 of them turn into 'copy' only in a degenerate case of more
x=0 or x=y-y or etc... - should we really ban subtraction based on this
observation?
/Opinion
--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups
"Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
tatumizer-v0.2
2017-11-08 03:11:00 UTC
Permalink
Interestingly, javascript seems to be inclined to follow the path of least
resistance WRT streams: it intends to support the metaphor of water streams:
https://streams.spec.whatwg.org/
Specifically, all streams are single-subscription streams, and if you want
2 subscriptions, use method 'tee' to split it in 2.
The idea is much simpler, but dart's latest proposal is more interesting
IMO. Except small problem with naming :)
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
tatumizer-v0.2
2017-11-08 03:12:46 UTC
Permalink
Post by 'Florian Loitsch' via Dart Misc
One of the reasons we want to add `copy` is because it also makes
`subbuffer` unnecessary (in the ByteBuffer class of dart:typed_data). If we
remove `start`/`end` we need to think about that method again...
Oh I see. Makes sense. And for substring -> copy, too - by implication :)
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
tatumizer-v0.2
2017-11-08 14:52:49 UTC
Permalink
But if you need a generic verb to cover subbuffer, substring and sublist,
that word is not 'copy' - rather, it's "cut".
Maybe dart needs both copy and cut? :)
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
'Florian Loitsch' via Dart Misc
2017-11-08 14:54:59 UTC
Permalink
Generally, we avoid verbs that could be read as imperative versions.
list.clear(); // => modifies the receiver.
list.cut(5); // Does not modify the receiver?
Post by tatumizer-v0.2
But if you need a generic verb to cover subbuffer, substring and sublist,
that word is not 'copy' - rather, it's "cut".
Maybe dart needs both copy and cut? :)
--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups
"Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
tatumizer-v0.2
2017-11-08 21:26:15 UTC
Permalink
It's a linguistic minefield LOL
How about "extract"?
I consulted the dictionary: you know, the word doesn't necessarily suggest
removal from receiver.
E.g, as a noun, it might mean citation/quotation.
Interesting topic indeed, gives a lot of food for thought :)

Generally, we avoid verbs that could be read as imperative versions.
Post by 'Florian Loitsch' via Dart Misc
list.clear(); // => modifies the receiver.
list.cut(5); // Does not modify the receiver?
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
Lee Crocker
2017-11-08 21:43:03 UTC
Permalink
Why not just apply slice() to all sequence-like types: buffers, lists, etc?
You might leave substr() around as an alias--a bit of historical cruft to
ease transition--but define it in terms of slice().
Post by tatumizer-v0.2
It's a linguistic minefield LOL
How about "extract"?
I consulted the dictionary: you know, the word doesn't necessarily suggest
removal from receiver.
E.g, as a noun, it might mean citation/quotation.
Interesting topic indeed, gives a lot of food for thought :)
Generally, we avoid verbs that could be read as imperative versions.
Post by 'Florian Loitsch' via Dart Misc
list.clear(); // => modifies the receiver.
list.cut(5); // Does not modify the receiver?
--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups
"Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
tatumizer-v0.2
2017-11-08 22:39:13 UTC
Permalink
Interesting thing about slice: it never meant "copy some part of" until
somebody started using it in APIs in that sense (not sure who).
But really, since it became common, maybe dart can just 'slice" it from
there?
Moreover, now people apply slice even to maps:
https://apidock.com/rails/Hash/slice
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
tatumizer-v0.2
2017-11-09 14:56:46 UTC
Permalink
Bad news. "slice", however good it may look on the surface, totally
compromised itself by having wrong parameters in javascript (negative
endIndex).
And this is not all. Dart generally doesn't like nouns as method.names. But
"slice" in this context is a noun, certainly. As a verb, it would mean a
different thing altogether, like "split".
If 'slice' is out, I'd like to re-submit "extract". It's a good word,
under-utilized in APIs, has very broad meaning, applies naturally to maps
and to any situation where you need to work hard to wring some part of the
whole (e.g. I can think of methods extractFoo, extractBar elsewhere).
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
'Florian Loitsch' via Dart Misc
2017-11-09 15:10:25 UTC
Permalink
"Extract" is a possibility.
The advantage of `copy` is that it also serves cases, where it doesn't just
take a subpart. For example, `map.copy()`, or `set.copy()`. The fact, that
one copy a subpart of the receiver is just a bonus. For sets and maps, the
subpart would be only "empty". `map.copy(empty: true)`. It's not always
useful, but sometimes we just want to have a similar map (identity or not),
without any elements. It's not completely clear, though, whether that's
enough. An immutable set/map wouldn't return a mutable one, so one wouldn't
be able to assume that the new empty set could be used for anything... We
could, of course, require that the returned set of `copy(empty: true)`
always must be mutable. Makes the contract a bit harder, though (and means
that the `runtimeType` wouldn't always be the same).
Post by tatumizer-v0.2
Bad news. "slice", however good it may look on the surface, totally
compromised itself by having wrong parameters in javascript (negative
endIndex).
And this is not all. Dart generally doesn't like nouns as method.names.
But "slice" in this context is a noun, certainly. As a verb, it would mean
a different thing altogether, like "split".
If 'slice' is out, I'd like to re-submit "extract". It's a good word,
under-utilized in APIs, has very broad meaning, applies naturally to maps
and to any situation where you need to work hard to wring some part of the
whole (e.g. I can think of methods extractFoo, extractBar elsewhere).
--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups
"Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
tatumizer-v0.2
2017-11-09 17:01:54 UTC
Permalink
Extract might have same semantics as copy WRT "object of what class gets
created". It's just here we have a case where 2 words are better than one
IMO.
Using just 'copy' with extra parameters to mean "extract" feels a bit
artificial.
For the purposes of just creating an instance of the same class (like in
your empty map example), copy doesn't feel like a right word to me. There's
a reason why natural languages have such variety of words that describe
similar, but not identical, things :) And if it's important to use the
right word (out of N possibilities) in informal conversation, then maybe in
the programming language it's even more so?
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
Günter Zöchbauer
2017-11-28 07:38:43 UTC
Permalink
Thanks for the feedback.
Post by 'Florian Loitsch' via Dart Misc
Post by Günter Zöchbauer
This all sounds great.
good to hear :)
Post by Günter Zöchbauer
I'm wondering though if moving Point and Rectangle to dart:html would
cause issues with packages that provide platform neutral functionality and
now would need the user of the package to convert all such values between
dart:html and the package version when passing them along.
Yes. We are definitely worried too.
It would really feel nice, if `dart:math` was just a bunch of constants
and functions. However, we might need to keep `Point` and `Rectangle`
there... If `dart:html` doesn't work (for the mentioned reasons), then
there doesn't seem to be a better place for them.
Post by Günter Zöchbauer
If Stream provides more RX style methods, a flatMapLatest equivalent is
IMHO worth considering.
There are of course a lot more that would be great to have, but I think
that's quite a common one.
We will consider it.
If I understand correctly (and Lasse is the one who really knows the
insides of Streams, this is basically just the equivalent of `asyncMap`
where the input stream isn't paused (and the output switches as soon there
is a new one).
- asyncMap(mapFun, switchLatest: true); // With a better named arg.
- asyncMapLatest(mapFun); // But "latest" isn't used anywhere else.
- something even better?
We already get pushback that there are too many methods on `Stream`, but
we will look into it.
GlaD to hear it's on your radar.
Sounds like another example where extension methods, as discussed in the
other thread, would be a great thing to have.
The rxdart package is working fine, so there is no rush.
Post by 'Florian Loitsch' via Dart Misc
Post by Günter Zöchbauer
https://github.com/dart-lang/sdk/blob/master/docs/newsletter/20171027.md
https://github.com/dart-lang/sdk/tree/master/docs/newsletter
Post by 'Florian Loitsch' via Dart Misc
Dart Language and Library Newsletter
Welcome to the Dart Language and Library Newsletter.
Library Updates
This week's newsletter is all about the planned library changes for
Dart 2.0.
Post by 'Florian Loitsch' via Dart Misc
We have collected our plans in this document.
Please let us know what you think.
--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups
"Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
Oliver
2017-10-29 07:59:21 UTC
Permalink
For the nice idea of providing Rx functionallity:
In case I use replay in Rx, I mostly use it with the buffer size set to one. So that it only replays the last value. Your proposal is missing that feature.
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
'Florian Loitsch' via Dart Misc
2017-10-30 14:00:01 UTC
Permalink
Post by Oliver
In case I use replay in Rx, I mostly use it with the buffer size set to
one. So that it only replays the last value. Your proposal is missing that
feature.
Good point.
We added `bufferSize` to the `replay` function.
Post by Oliver
--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups
"Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
Man Hoang
2017-10-29 14:09:23 UTC
Permalink
Below are the issues I found.

1. *List.lastIndexWhere* only searches against the first element if *start*
is not provided. The default value of *start* should be null, which means
searching backwards from the end of the list.
/**
* Returns the last index in the list that satisfies the provided
[predicate].
*
* Searches the list from index [start] to 0.
* The first time an object `o` is encountered so that `predicate(o)` is
true,
* the index of `o` is returned.
*
* ```
* List<String> notes = ['do', 're', 'mi', 're'];
* notes.lastIndexWhere((note) => note.startsWith('r')); // 3
* notes.lastIndexWhere((note) => note.startsWith('r'), 2); // 1
* ```
*
* Returns -1 if [element] is not found.
* ```
* notes.lastIndexWhere((note) => note.startsWith('k')); // -1
* ```
*/
int lastIndexWhere(bool predicate(E x), [int start = 0]);

https://dart-review.googlesource.com/c/sdk/+/15127/2/sdk/lib/core/list.dart#372

2. *parseTry* should be renamed to *tryParse*
https://dart-review.googlesource.com/c/sdk/+/15127/2/sdk/lib/core/date_time.dart#395
https://dart-review.googlesource.com/c/sdk/+/15127/2/sdk/lib/core/double.dart#231
https://dart-review.googlesource.com/c/sdk/+/15127/2/sdk/lib/core/duration.dart#129
https://dart-review.googlesource.com/c/sdk/+/15127/2/sdk/lib/core/int.dart#401
https://dart-review.googlesource.com/c/sdk/+/15127/2/sdk/lib/core/num.dart#470
https://dart-review.googlesource.com/c/sdk/+/15127/2/sdk/lib/core/uri.dart#756
https://dart-review.googlesource.com/c/sdk/+/15127/2/sdk/lib/core/uri.dart#3397
https://dart-review.googlesource.com/c/sdk/+/15127/2/sdk/lib/typed_data/bigint.dart#64

3. *int.parseHex* should not have the *onError *argument. Instead, a new
static method, *tryParseHex*, should be added. This is to align with the
*parse/tryParse* methods.
https://dart-review.googlesource.com/c/sdk/+/15127/2/sdk/lib/core/int.dart#425
Post by 'Florian Loitsch' via Dart Misc
https://github.com/dart-lang/sdk/blob/master/docs/newsletter/20171027.md
https://github.com/dart-lang/sdk/tree/master/docs/newsletter
Dart Language and Library Newsletter
Welcome to the Dart Language and Library Newsletter.
<https://github.com/dart-lang/sdk/blob/master/docs/newsletter/20171027.md#library-updates>Library
Updates
This week's newsletter is all about the planned library changes for Dart
2.0.
We have collected our plans in this document
<https://github.com/dart-lang/sdk/blob/master/docs/newsletter/lib/lib.md>.
Please let us know what you think.
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
a***@gmail.com
2017-11-05 01:30:57 UTC
Permalink
On the topic of "randomRange", I would propose "randomFromRange"
Post by Man Hoang
Below are the issues I found.
1. *List: lastIndexWhere* only searches against the first element if
*start* is not provided. The default value of *start* should be null,
which means searching backwards from the end of the list.
/**
* Returns the last index in the list that satisfies the provided
[predicate].
*
* Searches the list from index [start] to 0.
* The first time an object `o` is encountered so that `predicate(o)` is
true,
* the index of `o` is returned.
*
* ```
* List<String> notes = ['do', 're', 'mi', 're'];
* notes.lastIndexWhere((note) => note.startsWith('r')); // 3
* notes.lastIndexWhere((note) => note.startsWith('r'), 2); // 1
* ```
*
* Returns -1 if [element] is not found.
* ```
* notes.lastIndexWhere((note) => note.startsWith('k')); // -1
* ```
*/
int lastIndexWhere(bool predicate(E x), [int start = 0]);
https://dart-review.googlesource.com/c/sdk/+/15127/2/sdk/lib/core/list.dart#372
2. *parseTry* should be renamed to *tryParse*
https://dart-review.googlesource.com/c/sdk/+/15127/2/sdk/lib/core/date_time.dart#395
https://dart-review.googlesource.com/c/sdk/+/15127/2/sdk/lib/core/double.dart#231
https://dart-review.googlesource.com/c/sdk/+/15127/2/sdk/lib/core/duration.dart#129
https://dart-review.googlesource.com/c/sdk/+/15127/2/sdk/lib/core/int.dart#401
https://dart-review.googlesource.com/c/sdk/+/15127/2/sdk/lib/core/num.dart#470
https://dart-review.googlesource.com/c/sdk/+/15127/2/sdk/lib/core/uri.dart#756
https://dart-review.googlesource.com/c/sdk/+/15127/2/sdk/lib/core/uri.dart#3397
https://dart-review.googlesource.com/c/sdk/+/15127/2/sdk/lib/typed_data/bigint.dart#64
3. *int: parseHex* should not have the *onError *argument. Instead, a new
static method, *tryParseHex*, should be added. This is to align with the
*parse/tryParse* methods.
https://dart-review.googlesource.com/c/sdk/+/15127/2/sdk/lib/core/int.dart#425
4. Typo: quertion
https://dart-review.googlesource.com/c/sdk/+/15127/2/sdk/lib/core/uri.dart#4676
5. *int*: *randomInRange* is a better name than *randomRange*
https://dart-review.googlesource.com/c/sdk/+/15127/2/sdk/lib/core/int.dart#303
Post by 'Florian Loitsch' via Dart Misc
https://github.com/dart-lang/sdk/blob/master/docs/newsletter/20171027.md
https://github.com/dart-lang/sdk/tree/master/docs/newsletter
Dart Language and Library Newsletter
Welcome to the Dart Language and Library Newsletter.
<https://github.com/dart-lang/sdk/blob/master/docs/newsletter/20171027.md#library-updates>Library
Updates
This week's newsletter is all about the planned library changes for Dart
2.0.
We have collected our plans in this document
<https://github.com/dart-lang/sdk/blob/master/docs/newsletter/lib/lib.md>
.
Please let us know what you think.
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
tatumizer-v0.2
2017-11-06 00:00:14 UTC
Permalink
And ideally, "listen" should be renamed, too. Probably, to "stream" (as a
verb).
Conjecture: it would be absolutely impossible for a programmer to write a
correct program without understanding how it all works (except in simplest
cases)

Another linguistic discovery: turns out, "broadcast", "multicast" and*
"unicast"* are 3 standard terms.. Who knew? :)
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
'Florian Loitsch' via Dart Misc
2017-11-06 09:29:30 UTC
Permalink
When we did dart:async we used a lot of terms from other libraries and
languages. In retrospect, not all names fit. (`Stream` instead of
`Streamable`...).

We generally avoid verbs that can be read as nouns.
Post by tatumizer-v0.2
And ideally, "listen" should be renamed, too. Probably, to "stream" (as a
verb).
Conjecture: it would be absolutely impossible for a programmer to write a
correct program without understanding how it all works (except in simplest
cases)
Another linguistic discovery: turns out, "broadcast", "multicast" and*
"unicast"* are 3 standard terms.. Who knew? :)
--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups
"Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
'Florian Loitsch' via Dart Misc
2017-11-06 09:28:05 UTC
Permalink
Also possible: `randomInRange`.
Post by a***@gmail.com
On the topic of "randomRange", I would propose "randomFromRange"
Post by Man Hoang
Below are the issues I found.
1. *List: lastIndexWhere* only searches against the first element if
*start* is not provided. The default value of *start* should be null,
which means searching backwards from the end of the list.
/**
Post by Man Hoang
* Returns the last index in the list that satisfies the provided
[predicate].
*
* Searches the list from index [start] to 0.
* The first time an object `o` is encountered so that `predicate(o)`
is true,
* the index of `o` is returned.
*
* ```
* List<String> notes = ['do', 're', 'mi', 're'];
* notes.lastIndexWhere((note) => note.startsWith('r')); // 3
* notes.lastIndexWhere((note) => note.startsWith('r'), 2); // 1
* ```
*
* Returns -1 if [element] is not found.
* ```
* notes.lastIndexWhere((note) => note.startsWith('k')); // -1
* ```
*/
int lastIndexWhere(bool predicate(E x), [int start = 0]);
https://dart-review.googlesource.com/c/sdk/+/15127/2/sdk/lib/core/list.dart#372
2. *parseTry* should be renamed to *tryParse*
https://dart-review.googlesource.com/c/sdk/+/15127/2/sdk/lib/core/date_time.dart#395
https://dart-review.googlesource.com/c/sdk/+/15127/2/sdk/lib/core/double.dart#231
https://dart-review.googlesource.com/c/sdk/+/15127/2/sdk/lib/core/duration.dart#129
https://dart-review.googlesource.com/c/sdk/+/15127/2/sdk/lib/core/int.dart#401
https://dart-review.googlesource.com/c/sdk/+/15127/2/sdk/lib/core/num.dart#470
https://dart-review.googlesource.com/c/sdk/+/15127/2/sdk/lib/core/uri.dart#756
https://dart-review.googlesource.com/c/sdk/+/15127/2/sdk/lib/core/uri.dart#3397
https://dart-review.googlesource.com/c/sdk/+/15127/2/sdk/lib/typed_data/bigint.dart#64
3. *int: parseHex* should not have the *onError *argument. Instead, a
new static method, *tryParseHex*, should be added. This is to align with
the *parse/tryParse* methods.
https://dart-review.googlesource.com/c/sdk/+/15127/2/sdk/lib/core/int.dart#425
4. Typo: quertion
https://dart-review.googlesource.com/c/sdk/+/15127/2/sdk/lib/core/uri.dart#4676
5. *int*: *randomInRange* is a better name than *randomRange*
https://dart-review.googlesource.com/c/sdk/+/15127/2/sdk/lib/core/int.dart#303
Post by 'Florian Loitsch' via Dart Misc
https://github.com/dart-lang/sdk/blob/master/docs/newsletter/20171027.md
https://github.com/dart-lang/sdk/tree/master/docs/newsletter
Dart Language and Library Newsletter
Welcome to the Dart Language and Library Newsletter.
<https://github.com/dart-lang/sdk/blob/master/docs/newsletter/20171027.md#library-updates>Library
Updates
This week's newsletter is all about the planned library changes for Dart
2.0.
We have collected our plans in this document
<https://github.com/dart-lang/sdk/blob/master/docs/newsletter/lib/lib.md>
.
Please let us know what you think.
--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups
"Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
Man Hoang
2017-10-29 14:24:59 UTC
Permalink
4. Typo: quertion
https://dart-review.googlesource.com/c/sdk/+/15127/2/sdk/lib/core/uri.dart#4676
Post by 'Florian Loitsch' via Dart Misc
https://github.com/dart-lang/sdk/blob/master/docs/newsletter/20171027.md
https://github.com/dart-lang/sdk/tree/master/docs/newsletter
Dart Language and Library Newsletter
Welcome to the Dart Language and Library Newsletter.
<https://github.com/dart-lang/sdk/blob/master/docs/newsletter/20171027.md#library-updates>Library
Updates
This week's newsletter is all about the planned library changes for Dart
2.0.
We have collected our plans in this document
<https://github.com/dart-lang/sdk/blob/master/docs/newsletter/lib/lib.md>.
Please let us know what you think.
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
'Florian Loitsch' via Dart Misc
2017-10-30 14:01:27 UTC
Permalink
Thanks a lot.
I think I fixed all the mentioned issues.
Post by Man Hoang
4. Typo: quertion
https://dart-review.googlesource.com/c/sdk/+/15127/2/sdk/lib/core/uri.dart#4676
Post by 'Florian Loitsch' via Dart Misc
https://github.com/dart-lang/sdk/blob/master/docs/newsletter/20171027.md
https://github.com/dart-lang/sdk/tree/master/docs/newsletter
Dart Language and Library Newsletter
Welcome to the Dart Language and Library Newsletter.
<https://github.com/dart-lang/sdk/blob/master/docs/newsletter/20171027.md#library-updates>Library
Updates
This week's newsletter is all about the planned library changes for Dart
2.0.
We have collected our plans in this document
<https://github.com/dart-lang/sdk/blob/master/docs/newsletter/lib/lib.md>
.
Please let us know what you think.
--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups
"Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
Bluenuance
2017-10-31 19:33:45 UTC
Permalink
please do NOT move Point and Rectangle classes to the html package.

first my personal reasons:
I'm writing a 3d engine where the core is designed to be completly usable
without "html"
these would be the breakings which I need to remove:

<Loading Image...>
and this is only for "Point"....

Which would basically mean I would have to "copy" the Point class. This is
mentioned as "ok" which I find really strange, as since when does "battery
included" mean... "copy the source over and over again" - it always buffled
my why flutter uses their own Point class.
Especially when performance is a very very important "point" ;) there is an
additional cost because when running in an html surrounding it would mean
to convert these to the "internal" classes probably million of times!
Which makes the performance of the engine look bad and thus also dart.
(Don't forget that user see them most often as a "package")

Also, as "convenience" (programmer should immediatly know where which class
is...) goes point and rectangle should simply be in a "math" library.

Some examples:
first of all (because it is even from a "google" dart programmer):
https://github.com/google/vector_math.dart/tree/master/lib/src/vector_math
the "math" includes quads, vectors and so on... so points and rectangle
should be somewhere similar or?

here is the "rectangle" class from the unreal engine which is also under
...math...
https://docs.unrealengine.com/latest/INT/API/Runtime/Core/Math/FIntRect/index.html

so please do not move point and rectangle... as imho they are EXACTLY where
they should be
Post by 'Florian Loitsch' via Dart Misc
https://github.com/dart-lang/sdk/blob/master/docs/newsletter/20171027.md
https://github.com/dart-lang/sdk/tree/master/docs/newsletter
Dart Language and Library Newsletter
Welcome to the Dart Language and Library Newsletter.
<https://github.com/dart-lang/sdk/blob/master/docs/newsletter/20171027.md#library-updates>Library
Updates
This week's newsletter is all about the planned library changes for Dart
2.0.
We have collected our plans in this document
<https://github.com/dart-lang/sdk/blob/master/docs/newsletter/lib/lib.md>.
Please let us know what you think.
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
Filipe Morgado
2017-11-01 02:16:05 UTC
Permalink
Post by Bluenuance
please do NOT move Point and Rectangle classes to the html package.
I have yet to see a relevant package which depends on SDK's Point and
Rectangle.

Flutter, StageXL, and most 3D engines all made their custom stuff.

For a 3D engine you may want better integrated geometry classes, which use
'dart:typed_data' as storage.

Maybe it's even better to pass (x, y) everywhere to avoid allocating
Points. And store (x, y, w, h) in a Float16List (along with other stuff)
inside your render objects, to avoid allocating Rectangles.

Flash has "flash.geom" which includes almost everything we need. But Flash
is a 3D engine as well, Dart is not.
I'd like to see an optimized 'dart:geom' library, but what for? Only Point
and Rectangle? Why not use 'package:vector_math' instead?
Why even bother if most engines will use their own stuff anyway?

I'm all for (re)moving Point and Rectangle.
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
Manuel Messerer
2017-11-01 06:59:22 UTC
Permalink
Post by Filipe Morgado
I have yet to see a relevant package which depends on SDK's Point and
Rectangle.
sorry to say so, but you don't see them because dart is still lacking left
and right for community packages.

because of convenience. It's not that I use it internally for tesselations
or something like this ;)
but as my Vector2 class e.g. simply implements Point<double> you can often
pass the Point into all calculations which simply call x and y getters.
Also other packages that may be used depend on Points. Lets say someone
build a "maze generator" - he will not build vector and matrix and so on...
classes he will use "math" Point and Rectangles.
Now it would be great if he can simply feed them to the engine. So all
these packages would cooperate well when there are some basic "common"
structures. When everyone builds their own we are...
well should I say in the "javascript" world again? ;)

yes I CAN simply do my own... but then "battery included"... anyone still
remembers that? :o

just because it ALREADY got copied over and over again is no reason to move
it in my opinion because it leads to even more copy & paste.
Post by Filipe Morgado
Post by Bluenuance
please do NOT move Point and Rectangle classes to the html package.
I have yet to see a relevant package which depends on SDK's Point and
Rectangle.
Flutter, StageXL, and most 3D engines all made their custom stuff.
For a 3D engine you may want better integrated geometry classes, which use
'dart:typed_data' as storage.
Maybe it's even better to pass (x, y) everywhere to avoid allocating
Points. And store (x, y, w, h) in a Float16List (along with other stuff)
inside your render objects, to avoid allocating Rectangles.
Flash has "flash.geom" which includes almost everything we need. But Flash
is a 3D engine as well, Dart is not.
I'd like to see an optimized 'dart:geom' library, but what for? Only Point
and Rectangle? Why not use 'package:vector_math' instead?
Why even bother if most engines will use their own stuff anyway?
I'm all for (re)moving Point and Rectangle.
--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to a topic in the
Google Groups "Dart Misc" group.
To unsubscribe from this topic, visit https://groups.google.com/a/
dartlang.org/d/topic/misc/v4Yayq4vh2M/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
Sean Eagan
2017-10-31 19:54:27 UTC
Permalink
On Oct 27, 2017 9:15 PM, "'Florian Loitsch' via Dart Misc" <
Github link for this newsletter: https://github.com/dart-lang/
sdk/blob/master/docs/newsletter/20171027.md
Earlier newsletters: https://github.com/dart-lang/sdk/tree/master/docs/
newsletter
Dart Language and Library Newsletter
Welcome to the Dart Language and Library Newsletter.
<https://github.com/dart-lang/sdk/blob/master/docs/newsletter/20171027.md#library-updates>Library
Updates
This week's newsletter is all about the planned library changes for Dart
2.0.
We have collected our plans in this document
<https://github.com/dart-lang/sdk/blob/master/docs/newsletter/lib/lib.md>.
Please let us know what you think.
--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups
"Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
tatumizer-v0.2
2017-10-31 21:38:52 UTC
Permalink
However, the asBroadcastStream now becomes even more important: it makes
sure that listeners actually listen to the same instance of a multicast
stream. Every listener to the asBroadcastStream will receive the same
events (when subscribed at the same time).

So isBroadcastStream is removed, but asBroadcastStream is even more
important? And what do we get from asBroadcastStream? Turns out, it's not a
broadcast stream (as one would be tempted to assume), but a multicast
stream instead?
And multicast is not the same as broadcast (otherwise why would we need an
extra constructor for multicast?).

So where we had one word with vague meaning ('broadcast'),now we have two
('broadcast' and 'multicast').

I admit I don't understand this part of the document. Feel very confused.
Streams API was always enigmatic, but now - more than ever before :)

Maybe it's not just the terminology, but whole metaphor of radio
communication is to blame? Water piping is much simpler.
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
'Lasse R.H. Nielsen' via Dart Misc
2017-11-01 07:09:19 UTC
Permalink
Post by tatumizer-v0.2
However, the asBroadcastStream now becomes even more important: it makes
sure that listeners actually listen to the same instance of a multicast
stream. Every listener to the asBroadcastStream will receive the same
events (when subscribed at the same time).
So isBroadcastStream is removed, but asBroadcastStream is even more
important? And what do we get from asBroadcastStream? Turns out, it's not a
broadcast stream (as one would be tempted to assume), but a multicast
stream instead?
All streams are potentially "multicast". That's just called "being a
Stream". Instead of having two kinds of streams "single subscription" and
"broadcast", which really didn't cover the full range of possible streams
(no multi-subscription streams that weren't broadcast), we now just have
"stream" which can accept multiple listeners and treat them independently.
Some streams don't accept more listeners, that's their choice.

The "isBroadcast" requires there to be a kind of stream that *is a*
broadcast stream. That's no longer considered as a kind of stream, it's
just a behavior of a normal stream - a stream that allows multiple
listeners, and which sends the events of a source stream to all its current
listeners.
You could write it manually (and if we implement the Rx "replay" operation,
we will, since the asBroadcast stream is really just the zero-buffer-size
replay operation).
Post by tatumizer-v0.2
And multicast is not the same as broadcast (otherwise why would we need an
extra constructor for multicast?).
Mutlicast is not a *special* kind of stream. It is the *most general* way
to create a stream. A single subscription stream is a multicast stream
where the callback throws for every listen after the first. A broadcast
stream is a multicast stream that sends the events of the source stream to
all its current subscribers.
Stream.multicast is really the basic way to create a stream, everything
else is just optimization for common special cases.
Post by tatumizer-v0.2
So where we had one word with vague meaning ('broadcast'),now we have two
('broadcast' and 'multicast').
Forget them, and use one word: Stream. You can think of `asBroadcast()` as
a transformation, like `asyncMap(...)` - it creates a new stream from the
original stream. It just happens to be the only built-in one that creates a
stream that allows multiple subscriptions from one that doesn't. It's still
just "a stream" with a particular useful behavior, just as all the other
stream transformations. It's a stream behavior, not a stream *type*.

The same way, we generalize stream controllers, instead of having two kinds
(sync and async), we have one which can send events both synchronously or
asynchronously. Not a *kind*, just a choice. There really are much fewer
kinds of objects with this change - one general StreamController, one
general Stream, not two kinds of controllers for each of two kinds of
streams (which still weren't covering all the possible kinds of streams).
Post by tatumizer-v0.2
I admit I don't understand this part of the document. Feel very confused.
Streams API was always enigmatic, but now - more than ever before :)
I actually find it simpler, possibly because my mental model actually
became simpler with this change, but we haven't updated all the
documentation yet, and it's hard to understand from the source code alone.
I think of it as simplifying by generalizing - by removing the
specializations and embracing the general case, the code gets simpler and
the mental model gets simpler.
We retain `StreamController()` and `StreamController.broadcast()` because
they are useful speciailzations to optimizie for, but you can implement
them using `Stream.multicast`.
Post by tatumizer-v0.2
Maybe it's not just the terminology, but whole metaphor of radio
communication is to blame? Water piping is much simpler.
Metaphors are bad for specification. Car metaphors doubly so. "Broadcast"
was actually a fitting metaphor for what it was created for (infinite
streams of notification events, like DOM events). It's just too specific to
actually cover all the needs of multi-subscription streams.

Naming-wise, the "asBroadcastStream()" method is ... good enough, and
renaming it would be very breaking.
The "Stream.mutlicast" constructor might be worth renaming to something
less specific. Personally, I'd use the "unnamed" `Stream` constructor if it
wasn't taken already for subclassing, but it is, so we can't. What if it
was called `Stream.control` or something similar, stating that it is really
just creating a stream that you get to control each subscriber of?

/L
--
Lasse R.H. Nielsen - ***@google.com
'Faith without judgement merely degrades the spirit divine'
Google Denmark ApS - Frederiksborggade 20B, 1 sal - 1360 KÞbenhavn K
- Denmark - CVR nr. 28 86 69 84
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
tatumizer-v0.2
2017-11-01 14:00:20 UTC
Permalink
@Lasse: I'm sure current design makes perfect sense, but obscure
terminology stands in the way between perfect sense and the consumer of
this sense (which is a programmer :)
Let's try to sort things out.

When we have a single subscription stream, and want to transform it into
multi-subscription stream, the best term for it would be not 'multicast',
but (surprisingly?) 'multi-subscription stream', no? :)
What happens with current terminology is this: the antonym for
'single-subscription' is an enigmatic 'multicast' that sounds like rocket
science and just scares users off.

But this is not all. Here's what the Document says about multicast
Creates a stream where each individual listener has a fresh controller
Aha! Streams differ not only in their support of single vs multiple
subscribers, but also in their ability to provide individual controllers
per listener, right?
Now we have 3 *orthogonal* properties of the stream:
- how many subscribers can be supported (one vs many)
- buffered or not (it just happens that single-subscription streams are
buffered, otherwise implementation would be quite expensive - so the effect
is due to technical, not logical, considerations )
- has individual controller per listener or not

This realization (if true) is important. There are 3 properties! But the
words like multicast, broadcast etc. don't capture the meaning of "this
stream can have N subscribers, it's buffered/unbuffered, and provides(or
not) control on per-listener basis).
And in fact, the term 'cast', whatever it means, doesn't even occur in the
above description.

Once we realize that we have 3 orthogonal properties, won't it be better to
reflect this fact *somehow* (don't know how) in the names of
constructors/methods?

(Sorry in advance If I misunderstood something :)
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
'Florian Loitsch' via Dart Misc
2017-11-01 14:50:25 UTC
Permalink
Post by tatumizer-v0.2
@Lasse: I'm sure current design makes perfect sense, but obscure
terminology stands in the way between perfect sense and the consumer of
this sense (which is a programmer :)
Let's try to sort things out.
When we have a single subscription stream, and want to transform it into
multi-subscription stream, the best term for it would be not 'multicast',
but (surprisingly?) 'multi-subscription stream', no? :)
We will discuss "multiSubscription" as a replacement for 'multicast'. You
are right that there shouldn't be a need to bring in a new word that we
need to explain.

What happens with current terminology is this: the antonym for
Post by tatumizer-v0.2
'single-subscription' is an enigmatic 'multicast' that sounds like rocket
science and just scares users off.
But this is not all. Here's what the Document says about multicast
Creates a stream where each individual listener has a fresh controller
Aha! Streams differ not only in their support of single vs multiple
subscribers, but also in their ability to provide individual controllers
per listener, right?
It's not really the `Stream` that differs. It's how the emitter deals with
new listeners. It feels easier to talk about it as "the stream has a new
controller for each listener".
Post by tatumizer-v0.2
- how many subscribers can be supported (one vs many)
- buffered or not (it just happens that single-subscription streams are
buffered, otherwise implementation would be quite expensive - so the effect
is due to technical, not logical, considerations )
- has individual controller per listener or not
I wouldn't call this an orthogonal property. (see below).
Post by tatumizer-v0.2
This realization (if true) is important. There are 3 properties! But the
words like multicast, broadcast etc. don't capture the meaning of "this
stream can have N subscribers, it's buffered/unbuffered, and provides(or
not) control on per-listener basis).
And in fact, the term 'cast', whatever it means, doesn't even occur in the
above description.
Once we realize that we have 3 orthogonal properties, won't it be better
to reflect this fact *somehow* (don't know how) in the names of
constructors/methods?
I think it's very important to make two distinctions:
1. what is a stream, and how does it behave.
2. what is an "event-emitter" (usually a `StreamController`)

In lib2 we try hard to entangle those two concepts. A `Stream` is simply an
object where I can subscribe to and get asynchronous notifications.

There are many more options on the emitter side:
1. synchronous or not.
2. how many listeners are allowed?
3. deal with each subscriber individually or not?
4. buffer data when there is no listener? (this is more of a question for
the individual StreamController than for the `emitter`, but it is somehow
in the same category).

In lib1 we made the mistake of thinking that two of the combinations would
be enough: "single-subscription" and "broadcast".
In lib2 we want to go away from this "2 stream-type" thinking. For one,
it's not the `Stream` that is different, but the emitter (represented by a
`StreamController`), and, second, there is no need to only allow two
versions.
In theory, we could drop the names "single-subscription" and "broadcast" at
that time. We are just very used to them and think that their concepts
still serve a lot of use cases.

It might still be interesting to remove these names and just make these
properties named arguments (or something). My first instinct is that it
wouldn't work nicely, because the signatures for streams that only accept
one listener is somehow different to the one that allows multiple listeners.

```
class StreamController {
/// The provided callback is invoked for every listener.
StreamController(void onListen(EventSink sink));

/// Same as [StreamController], but throws error when there is more
/// than one listener.
StreamController.single(void onListen(EventSink sink));

/// Same as [StreamController], but just distributes the given event
/// to all individual listeners that are subscribed.
StreamController.broadcast(void onListen(EventSink sink));

Stream get stream;
}
```

There are clearly some things missing now: there is no way to deal with
`cancel`, the `EventSink` doesn't allow to emit synchronous events, there
is no way to buffer in the controller...

However, fundamentally, it feels simpler: a Stream is backed by a
controller. Whenever the stream gets a listener, the corresponding callback
is invoked.
For simplicity there are named constructors that cover common use cases
(single and broadcast subscriptions).

I don't think that going this far is necessary (or even helpful at this
stage), but this is how we think about Streams and StreamControllers.

I hope this makes sense.
Post by tatumizer-v0.2
(Sorry in advance If I misunderstood something :)
--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups
"Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
Alex Tatumizer
2017-11-01 16:22:48 UTC
Permalink
Post by 'Florian Loitsch' via Dart Misc
/// Same as [StreamController], but just distributes the given event
/// to all individual listeners that are subscribed.
StreamController.broadcast(void onListen(EventSink sink));
What is the meaning of "just distributes"? As opposed to what? Above,
default constructor says it invokes callback for every new listener. And
this one (broadcast), invokes onListen callback ... when?
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
'Florian Loitsch' via Dart Misc
2017-11-01 16:39:16 UTC
Permalink
Post by Alex Tatumizer
Post by 'Florian Loitsch' via Dart Misc
/// Same as [StreamController], but just distributes the given event
/// to all individual listeners that are subscribed.
StreamController.broadcast(void onListen(EventSink sink));
What is the meaning of "just distributes"? As opposed to what? Above,
default constructor says it invokes callback for every new listener. And
this one (broadcast), invokes onListen callback ... when?
It would maintain the same behavior as the current broadcast stream. (Which
is why I didn't add lots of documentation).
A broadcast controller publishes events to all *current* listeners. It
doesn't care whether a listener is too late or unsubscribes earlier.
This is a special case of the multi-subscription controller, where all
individual listeners are (usually) treated separately. For example `new
File().openRead()`, if multi-subscription, would want each subscriber to be
completely independent.

You could implement `StreamController.broadcast` *roughly* as follows.
(corner cases missing and only dealing with values):

// Just forwards the add-values to a given handler.
class _BroadSink implements EventSink {
final _handler;
_BroadSink(this.handler);
add(x) => handler(x);
}

factory StreamController.broadcast(void onListen(EventSink sink)) {
var listeners = [];
return new StreamController((EventSink sink) {
listeners.add(sink);
if (listeners.length == 1) { // First listener. Start emitting events.
onListen(new _BroadSink((event) { listeners.forEach((sink) {
sink.add(event); }); }));
}
}
}
Post by Alex Tatumizer
--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups
"Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
tatumizer-v0.2
2017-11-01 20:02:48 UTC
Permalink
@Florian: if you remove the term 'multicast' - things will improve a lot.
Otherwise, multicast vs broadcast creates a false dichotomy and leads to
confusion. (Neither of these names speaks for itself in the context).

The term 'broadcast' makes perfect sense to characterize a *controller*
('this is the controller for broadcast'), but this doesn't automatically
mean that the expression 'broadcast stream' makes sense.
It may, if you define it as a "stream controlled by a broadcast
controller", but for someone who learns the stuff, this might not be
obvious at all. (BTW, is this even correct?)

I will give it all another read, may come back with more complaints later :)
Thanks!
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
Alex Tatumizer
2017-11-02 00:14:05 UTC
Permalink
After another pass through the document (plus current API)
You know what, now I don't understand what kind of optimization is made
possible by single-subscription stream (and corresponding controller).
I thought it provides bufferization, but it seems (at least on logical
level) it doesn't.
Because the method 'pause" is available through .... Subscription, not
Stream or StreamController.
So the natural conclusion that one can make from this is that Subscription
itself provides bufferization.

Maybe there're other optimizations there in single-subscription stream?
Which ones?

If single-subscription streams are gone, then things simplify a lot - on
cognitive level, at least; implementation - under the hood - may become a
bit more difficult, but who cares.
And even in principle: why optimization should dictate the design, creating
cognitive load for the user (that is, the programmer)?
Programmer needs understanding, not only to know 'what', but also 'why'.
And this is an understatement: without 'why' it's quite difficult to
understand 'what'.
And "why" is exactly the problem with current (or proposed design).

Maybe there's a way to somehow sweep single-subscription under the rug?

But even if not, then the next best candidate would be: once it's an
optimization, pass 'single-subscription' mode in 'options' (as we always do
for optimization flags)

How about that?
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
tatumizer-v0.2
2017-11-02 12:53:39 UTC
Permalink
For example, a new File("foo.txt") may be implemented as a multicast
stream, where each listener just opens the file again.

Not sure I understand how it all works. Some streams pretend they are
completely buffered THEMSELVES? Regardless of listeners?
So we have a buffer inside stream, and another buffer - in subscription
(which allows to 'pause' and 'resume')?

But.... consider stdin - it's a stream. When we listen to it, we don't
expect to get all the key events since yesterday (for every invocation of
listen()).
So we have 2 sorts of streams - with memory and without? Or maybe 3rd type
is: stream with memory, but the memory saves data only until the first
listener connects?
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
'Lasse R.H. Nielsen' via Dart Misc
2017-11-02 15:13:08 UTC
Permalink
Streams really are just the asynchronous version of `Iterable`.

An Iterable can be backed by multiple different classes (Set, List, sync*,
...). As a user of the Iterable you generally don't need to know. The only
thing you know is that you can iterate over the elements.

The same is true for Streams. A Stream is an asynchronous Iterable: you can
listen to it and get events. Whether the source is buffered, broadcast, ...
is something you generally don't need to be concerned about, just what
events it promises to give you, and what you do with them.

In C#, file operations are modelled on top of `Enumerable` (our
`Iterable`). So having different kinds of Iterables isn't unheard of.
See here for the most common answer to "how to read lines from stdin":

public static IEnumerable<string> ReadLines()
{
string line;
while(null != (line = Console.ReadLine()))
yield return line;
}

This is an enumerable that won't behave the same way as a List does. If
it's iterated twice, it will behave surprisingly and it can't be restarted
from scratch. It's still a valid IEnumerable satisfying all the
requirements of such.

To make this even clearer, we distinguish between the "Stream" and the
"Stream source" (aka "event source", "event emitter"). Streams can be made
in different ways, but most are either async* functions or by a
`StreamController` (and internally, async* functions use a StreamController
too). The decisions about which events are emitted when are handled by the
code the feeds the events into the stream. The users of Streams should only
see a "Stream" (similar to Iterable) and not care about the details of how
it's built.
Post by tatumizer-v0.2
For example, a new File("foo.txt") may be implemented as a multicast
stream, where each listener just opens the file again.
Not sure I understand how it all works. Some streams pretend they are
completely buffered THEMSELVES? Regardless of listeners?
I think you are thinking of streams as its sequence of events. That's why
you think that it's *buffering*, because the events are the primary focus.
If you have a stream corresponding to a file, you can let each listener
independently read that file. If the file changes between subscriptions,
the newer ones see the new content.
The only difference between that and using a single-subscription stream is
that you need to create two single-subscription streams to read the file
twice, but you can listen twice to the multi-subscription stream. The
actual events are exactly the same in the two cases.

Streams are not their events because the same stream can provide different
events depending on when it's listened to, and how it's designed to behave
when listener to more than once. That's a design choice for the code that
creates the stream, not an inherent property of the stream itself.

You could have a stream like `randomIntegers` which provide a sequence of
random integers in the range 0..255, one every second. You can listen more
than once, each listener gets their own uncorrelated random numbers.
Or a stream of unique ID numbers:

var _id = 0;
var ids = new Stream<int>.multicast((c) {
var t;
run() {
t = new Timer.periodic(const Duration(seconds: 1), (_) {
c.addSync(_id++);
});
}
c.onCancel = c.onPause = () {
t.cancel();
};
(c.onResume = run)();
});

This stream can be listened to multiple times. Each individual listener
gets a sequence of unique numbers.
The numbers are highly correlated, but the streams have no event in common.

There doesn't *have* to be a connection between the events of independent
listens, but some streams do have a connection. Each stream gets to decide
for itself how it behaves when you listen to it. There are many options,
anyone creating a stream should pick the behavior that best matches the
task at hand.

The stream controller is a way to feed events to a stream listener. The
controllers in the platform libraries are built to ensure that events fed
into the controller will be delivered in the same order to the listener. We
are permissive and allow you to add events while paused (we could have
decided to not allow that), and if you do that, the event is buffered.
That's a property of the controller and not the stream - the stream just
delivers events as it's being instructed to. Buffering in that case is a
choice, chosen by the owner of the controller.
Post by tatumizer-v0.2
So we have a buffer inside stream, and another buffer - in subscription
(which allows to 'pause' and 'resume')?
Streams deliver events to subscribers. Listeners can pause, resume and
cancel. Whoever generates the events should honor that. If you use a
StreamController to feed the stream subscription, you should still honor
pauses (but we help you by buffering if you decide not to, because in some
cases, it's actually convenient).
Post by tatumizer-v0.2
But.... consider stdin - it's a stream. When we listen to it, we don't
expect to get all the key events since yesterday (for every invocation of
listen()).
Probably not. But if you pause the subscription, you expect to get the
remaining characters in the stream. Otherwise things like `await for` won't
work anymore. They may pause the input stream when they are blocked on
other asynchronous operations:

await for (var x in someStream) {
await handleData(x); // May pause `someStream`.
}

Assuming a "pause" happens, then the subscription sends a "pause" request.
If that request isn't honored (shouldn't happen but may), then the
subscription still makes sure that no other event happens or is lost.
Otherwise the `await for` would be really weird.
We (or the dart:io library designers) need to decide what the behavior of
stdin is. Should it allow multiple concurrent listeners? Should it buffer
while nobody listens? What is the most reasonable *behavior* of a stream
representing stdin? With Dart 2 streams, anything is possible, you don't
have to constrain yourself to either single-subscription or broadcast.
Post by tatumizer-v0.2
So we have 2 sorts of streams - with memory and without? Or maybe 3rd type
is: stream with memory, but the memory saves data only until the first
listener connects?
Similar to Iterables, there are *many* different kinds of streams.
Buffering is an implementation detail. For some behaviors, it's necessary.
For other behaviors it's optional. For some it's completely unnecessary.

Each stream should do what works best for the problem it's trying to solve.
Fitting everything into either single-subscription or broadcast didn't
allow that, so we remove the restrictions that limit you to those two
options.

/L
--
Lasse R.H. Nielsen - ***@google.com
'Faith without judgement merely degrades the spirit divine'
Google Denmark ApS - Frederiksborggade 20B, 1 sal - 1360 KÞbenhavn K
- Denmark - CVR nr. 28 86 69 84
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
tatumizer-v0.2
2017-11-02 16:23:37 UTC
Permalink
Post by 'Lasse R.H. Nielsen' via Dart Misc
I think you are thinking of streams as its sequence of events.
OMG!

This explains my confusion! And probably invalidates all my earlier
complaints :)
But if it's not a sequence of events, then what is it?
Can I think of it as a *device* that produces sequences of events on per
listener basis?
The problem is that as soon as you say 'stream' - the word comes loaded
with a metaphor of sequence of events. You personally might not like
metaphors, but this doesn't have any effect on the reader of your API.
"stream" in the natural language is always a 'stream of ' something. And in
dart, it's not!

Now I have to rethink the whole thing all over again :)
Post by 'Lasse R.H. Nielsen' via Dart Misc
The users of Streams should only see a "Stream" (similar to Iterable) and
not care about the details of how it's built.
Depends. Not sure I even agree with that. Understanding how things work is
important for many people. And often this understanding is essential for
programming.
I have personal experience to prove that. When I started programming, I had
to learn FORTRAN, and was writing code for a couple of years. Always had a
feeling that I don't actually know what I was doing.
Then I learned Assembler - and it made a huge difference.
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
Alex Tatumizer
2017-11-02 21:35:10 UTC
Permalink
Because Stream is like an Iterable, I renamed Stream to Streamable in my
head, and re-read the document.
And you know what - now things started making sense!
Because Streamable is something that, by the very definition of it, can
stream, then we can ask HOW it will stream.
So different modes of streaming fit nicely into this picture: multicast,
broadcast and single (which I renamed for myself to 'dedicated')
These are just the modes of streaming.

And then,all examples suddenly make sense: when we open a file, we get
"Streamable". It's *able to stream*. There's quite a bit of a difference
between 'able to stream' and 'stream', isn't it? :)
Stream in a conventional sense (as sequence of data) is created when we
listen to streamable. File is a streamable, so when we listen to it, *it
streams the whole content of the file to us*. Which is logical.
(However, If we call the file a Stream, then this is NOT what I would
expect. Maybe it's just me though) :)

Thanks for explaining!
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
'Lasse R.H. Nielsen' via Dart Misc
2017-11-03 06:58:53 UTC
Permalink
Post by Alex Tatumizer
Because Stream is like an Iterable, I renamed Stream to Streamable in my
head, and re-read the document.
And you know what - now things started making sense!
Indeed. I don't think we will want/be able to rename the classes now, but
thinking of Stream as Streamable and of StreamSubscription as Stream will
make the symmetry with Iterable/Iterator more visible.
Post by Alex Tatumizer
Because Streamable is something that, by the very definition of it, can
stream, then we can ask HOW it will stream.
So different modes of streaming fit nicely into this picture: multicast,
broadcast and single (which I renamed for myself to 'dedicated')
These are just the modes of streaming.
And then,all examples suddenly make sense: when we open a file, we get
"Streamable". It's *able to stream*. There's quite a bit of a difference
between 'able to stream' and 'stream', isn't it? :)
Stream in a conventional sense (as sequence of data) is created when we
listen to streamable. File is a streamable, so when we listen to it, *it
streams the whole content of the file to us*. Which is logical.
(However, If we call the file a Stream, then this is NOT what I would
expect. Maybe it's just me though) :)
It's not just you. We have the same problem all the time when writing
documentation. We say that "when you cancel the stream" because it's easily
understandable, even if it should really be "when you cancel the stream
subscription". Everybody, ourselves included, identifies the stream with
the events, even if it rightly is the stream subscription that is the
active part - and when one stream can make multiple independent
subscriptions, that error of that identification becomes visible.
Post by Alex Tatumizer
Thanks for explaining!
Glad that it makes sense :)

/L
--
Lasse R.H. Nielsen - ***@google.com
'Faith without judgement merely degrades the spirit divine'
Google Denmark ApS - Frederiksborggade 20B, 1 sal - 1360 KÞbenhavn K
- Denmark - CVR nr. 28 86 69 84
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
tatumizer-v0.2
2017-11-03 14:25:47 UTC
Permalink
I think I know what happened. The name 'Stream" was OK when we had only
single-subscription or broadcast streams.
In both cases, you could still think of Stream as a sequence of events
triggered when the (first) listener comes in.
So if there was some cognitive dissonance, it was relatively minor. Not so
with the proposed general kind of stream (let's call it multicast).
This one doesn't fit the metaphor of sequence of events any more, because
each listener gets its own sequence of events.
I know renaming is not an option, but better explanation is.
However, this shouldn't be necessary: all transformations could just
forward their listen-requests. That is, when a transformed stream is
listened to, the transformer should just ask the next stream for a
stream-subscription and transform the events this way. This means that a
transformed broadcast stream could still accept multiple listeners, even if
the resulting stream was not a broadcast stream.

"next stream" -> "ingress stream" (I got stuck on the word 'next' )

Now consider example:
var s= sourceStream.transform1().transform2();

when we invoke s.listen(), then (and only then) method listen() gets
invoked on sourceStream, after propagating though intermediate streams.
We can invoke s.listen() another time, and again listen() requests
propagates to the sourceStream. - so if sourceStream is a file, we get the
entire content of it.
Now if we ask: what is the streaming mode of s? Is it correct to say that
streaming mode of s is the same as streaming mode of sourceStream?
(probably yes)

I think some comment to this effect could be helpful in the documentation.
The way how it's worded today might not be 100% clear,

Pictures in the Document don't help much IMO (I had difficulty interpreting
them).
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
Continue reading on narkive:
Loading...