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 |
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 <[hidden email]> 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 > |
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 <[hidden email]> 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 <[hidden email]> 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 > > > |
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 <[hidden email]> 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 <[hidden email]> 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 <[hidden email]> 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 > > > > > > |
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 <[hidden email]> 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 <[hidden email]> 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 <[hidden email]> 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 <[hidden email]> 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 > > > > > > > > > > |
Either is abstract already ;)
On 23 November 2015 at 21:54, Gyula Fóra <[hidden email]> wrote: > 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 <[hidden email]> 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 <[hidden email]> 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 <[hidden email]> 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 <[hidden email]> > 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 > > > > > > > > > > > > > > > |
I opened a PR: https://github.com/apache/flink/pull/1402 with my
suggestions, let me know what you think and we can either merge this or leave it as it is :) I would also like to hear the opinions of others about this. Vasiliki Kalavri <[hidden email]> ezt írta (időpont: 2015. nov. 23., H, 22:03): > Either is abstract already ;) > > On 23 November 2015 at 21:54, Gyula Fóra <[hidden email]> wrote: > > > 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 <[hidden email]> 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 <[hidden email]> 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 <[hidden email]> 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 <[hidden email]> > > 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 > > > > > > > > > > > > > > > > > > > > > |
Free forum by Nabble | Edit this page |