Re: RFR 4358774: Add null InputStream and OutputStream
On Dec 8, 2017, at 10:52 AM, David Lloyd <david.lloyd@redhat.com> wrote:
On Fri, Dec 8, 2017 at 12:38 PM, Brian Burkhalter <brian.burkhalter@oracle.com> wrote:
Patrick’s comment made us think again about the naming here as “nullStream()” would not fit for eventual equivalent methods on Reader and Writer. It might be better to go with something like
InputStream InputStream.nullSource(); OutputStream.nullSink();
and later
Reader.nullSource(); Writer.nullSink();
Another alternative would be simply to reflect the class names in the methods:
InputStream InputStream.nullInputStream(); OutputStream.nullOutputStream();
and later
Reader.nullReader(); Writer.nullWriter();
I for one prefer this alternative; it's very clear and unambiguous. The second one?
Thanks, Brian
Like David, I prefer the `null{$ClassName}` alternative to `null{Source|Sink}`. (I assume from his wording that he prefers `null{$ClassName}`.) I prefer `null{$ClassName}` not only because it's less ambiguous, but also because Guava has existing types `{Byte|Char}Source` and `{Byte|Char}Sink`, so I'd find it a bit confusing to see `nullSource()` at first (especially if it were statically-imported) as I would initially expect it to have a return type of `*Source`. Cheers, Jonathan On 8 December 2017 at 19:03, Brian Burkhalter <brian.burkhalter@oracle.com> wrote:
On Dec 8, 2017, at 10:52 AM, David Lloyd <david.lloyd@redhat.com> wrote:
On Fri, Dec 8, 2017 at 12:38 PM, Brian Burkhalter <brian.burkhalter@oracle.com> wrote:
Patrick’s comment made us think again about the naming here as “nullStream()” would not fit for eventual equivalent methods on Reader and Writer. It might be better to go with something like
InputStream InputStream.nullSource(); OutputStream.nullSink();
and later
Reader.nullSource(); Writer.nullSink();
Another alternative would be simply to reflect the class names in the methods:
InputStream InputStream.nullInputStream(); OutputStream.nullOutputStream();
and later
Reader.nullReader(); Writer.nullWriter();
I for one prefer this alternative; it's very clear and unambiguous. The second one?
Thanks,
Brian
On Fri, Dec 8, 2017 at 1:03 PM, Brian Burkhalter <brian.burkhalter@oracle.com> wrote:
On Dec 8, 2017, at 10:52 AM, David Lloyd <david.lloyd@redhat.com> wrote:
On Fri, Dec 8, 2017 at 12:38 PM, Brian Burkhalter <brian.burkhalter@oracle.com> wrote:
Patrick’s comment made us think again about the naming here as “nullStream()” would not fit for eventual equivalent methods on Reader and Writer. It might be better to go with something like
InputStream InputStream.nullSource(); OutputStream.nullSink();
and later
Reader.nullSource(); Writer.nullSink();
Another alternative would be simply to reflect the class names in the methods:
InputStream InputStream.nullInputStream(); OutputStream.nullOutputStream();
and later
Reader.nullReader(); Writer.nullWriter();
I for one prefer this alternative; it's very clear and unambiguous. The second one?
Yes, sorry. -- - DML
participants (3)
-
Brian Burkhalter
-
David Lloyd
-
Jonathan Bluett-Duncan