I'm not sure what backwards compatibility means when it comes to typespecs
or if we have any rules for it in Elixir. All code still works the same way
when changes are made to typespecs so what is the potential
incompatibility? External tools (like dialyzer) may be affected but we
don't control those and they can chose to interpret typespecs however they
want.

I don't think making a typespec less restrictive is a backwards
incompatible change if no APIs change. It also depends on if the type is
used as arguments to functions or as return values. Accepting more values
in arguments is backwards compatible, but returning more types of values is
not.

The solution might be to instead deprecate Enum.index/0 if there is no
common type that makes sense for all indexes Elixir use.

On Mon, Jul 4, 2016 at 6:37 PM, eksperimental <[email protected]>
wrote:

> I just noticed that the Enum.index/0 type is set to `non_neg_integer`,
> the thing is that indexes are `integer`.
>
> as of now, it is only used one in the whole elixir code base,
> in Enum.find_index/2
>
> The rest of the times, when we need to represent an index, we need to
> use `integer`,
> I know this change is backward incompatible (and probably have to wait
> until Elixir v2.0), as other libraries/apps may rely on
> Enum.index/0,
>
> but it would make a lot of sense to change it to `integer` and update
> Enum.find_index/2 to use `non_neg_integer` instead of index/0.
>
> --
> You received this message because you are subscribed to the Google Groups
> "elixir-lang-core" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/elixir-lang-core/20160704233754.6acc2ca5.eksperimental%40autistici.org
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Eric Meadows-Jönsson

-- 
You received this message because you are subscribed to the Google Groups 
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/CAM_eapgOWppHfMtfGaUyVYbQ0EAdTPLB1e%3DRGdy9tniwzY%3DP7Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to