Vavr: Thoughts on adding Tuple2.empty(), Tuple3.empty() ....... ?

Created on 4 May 2017  路  3Comments  路  Source: vavr-io/vavr

Recently I came across a situation where if a condition failed returning Tuple2.empty() would have been good.
Any thoughts on adding Tuple{2,3,4....}.empty() ?

Unrelated question:
Is there going to be renaming of the packages from javaslang to vavr?

Thanks for the great library.

question 芦vavr-core禄

All 3 comments

Hi,

Any thoughts on adding Tuple{2,3,4....}.empty() ?

I think that is not possible. What should be an instance of an empty Tuple2? We will not use null as placeholder for nothing!

E.g. the following is no option for us:

// = Tuple2(null, null)
Tuple2<Void, Void> empty = Tuple2.empty();

Are you aware of Tuple0, the empty tuple?

Is there going to be renaming of the packages from javaslang to vavr?

Yes, we have to do it. We are not allowed to use the name 'javaslang' anymore. Because renaming the package is not backward compatible in the sense of a 'drop-in' replacement, we will also take the opportunity and make changes to the API that were previously targeted for javaslang 3.0.0.

The new vavr release will have the version 0.9.0. We have to ship a release neartime for several reasons and want to have a 'backdoor' to ship a major release (i.e. 1.0.0) short time after 0.9.0. However, we plan to do all backward incompatible changes in 0.9.0, so maybe a 0.10.0 will follow.

Btw, we did the same with Option by adding

interface Option {
    static Option<Void> nothing() {
        return Some(null);
    }
}

This confused our users. We will remove it with the upcoming release.

Thank you for answering!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

carnott-snap picture carnott-snap  路  4Comments

rumatoest picture rumatoest  路  5Comments

roookeee picture roookeee  路  5Comments

yarulan picture yarulan  路  5Comments

noorulhaq picture noorulhaq  路  5Comments