manifold-systems / manifold

Manifold is a Java compiler plugin, its features include Metaprogramming, Properties, Extension Methods, Operator Overloading, Templates, a Preprocessor, and more.
http://manifold.systems/
Apache License 2.0
2.43k stars 125 forks source link

[Inconsistency] Iterable.mapIndexed/mapNotNull/mapIndexedNotNull method name not aligned with other methods #492

Closed CC007 closed 1 year ago

CC007 commented 1 year ago

Describe the inconsistency The class ManIterableExt contains (among others) the following extension methods:

These are nice and consistent, with a List<T> or a chosen destination Collection<? super T> as a result and still allowing for a filter and filterIndexed to be implemented, which would return a Stream<T>.

If you look at the map variants though, I would expect:

However instead of mapIndexedToList, the method is named mapIndexed. As a result, it is impossible to create your own extension method that is called mapIndexed that would return a stream.

The same is true for mapNotNull, which should have been mapNotNullToList and mapIndexedNotNull, which should have been mapIndexedNotNullToList

Desktop (please complete the following information):

CC007 commented 1 year ago

It would also be nice if the IntelliJ plugin showed these method signature conflict issues before compilation.

rsmckinney commented 1 year ago

Yep, I agree with you here regarding the naming, they should have been more specific, or perhaps should have just worked with streams. Renaming these could bother some folks, however. I haven't received much feedback around collection extensions etc., so I'll consider renaming and asking for forgiveness or back out the changes if need be.

CC007 commented 1 year ago

You could maybe add the correct name as well and mark the old one as @Deprecated(forRemoval = true) and wait for your next major release to actually remove it.