I think it is not too bad to only have the Right/Left classes. You can then
write it like this:

Either<String, Integer> e1 = new Left<>("");
Either<String, Integer> e2 = new Right<>(1);

(this would be pretty much like in scala)

or we can add static methods like: Left.of(...), Right.of(...) which would
work exactly as it does now.

And then we can live without the static methods in Either (Either would
become Abstract).

Gyula

Vasiliki Kalavri <vasilikikala...@gmail.com> ezt írta (időpont: 2015. nov.
23., H, 21:25):

> Ah I see. Well, as I also said in the PR, Left and Right make no sense on
> their own, they're helper classes for Either. Hence, I believe they should
> be private. Maybe we could rename the methods to createLeft() /
> createRight() ?
>
> On 23 November 2015 at 20:58, Gyula Fóra <gyula.f...@gmail.com> wrote:
>
> > I was actually not suggesting to drop the e.left() method but instead the
> > Either.left(val).
> > Renaming the left(), right() methods might be confusing as than it would
> be
> > inconsistent with the scala version.
> >
> > On the other hand we could change the way the user can create the Left
> > Right classes, maybe directly expose them instead of the static method.
> (or
> > rename the static method)
> >
> > Gyula
> >
> > Vasiliki Kalavri <vasilikikala...@gmail.com> ezt írta (időpont: 2015.
> nov.
> > 23., H, 20:14):
> >
> > > Hey Gyula,
> > >
> > > I don't think dropping the method is a good idea. We need a way to
> > retrieve
> > > left and right values, no?
> > > How about renaming to getLeft() / getRight()?
> > >
> > > -V.
> > >
> > > On 23 November 2015 at 09:55, Gyula Fóra <gyula.f...@gmail.com> wrote:
> > >
> > > > Hey guys,
> > > >
> > > > I know this should have been part of the PR discussion but it kind of
> > > > slipped through the cracks :)
> > > >
> > > > I think it might be useful to change the method name for
> > > Either.left(value)
> > > > to Either.Left(value) (or drop the method completely).
> > > >
> > > > The reason is that it is slightly awkward to use it with java 8
> > lambdas.
> > > > You cannot use Either::left because of the name clash. Maybe it's
> not a
> > > > huge issue but a small inconvenience that will come up more often as
> we
> > > are
> > > > gradually moving to java 8 anyways :)
> > > >
> > > > What do you think?
> > > > Gyula
> > > >
> > >
> >
>

Reply via email to