When importing a fast code module,
You expect the result to be completely additive.
That is to say:
The potential for new functionality comes at no cost
(other than say a modest increase in the size of your app package).
and * boom * – your app can
determine the language of text;
and – * whoosh * – your app can
respond to changes in device direction.
But it would be surprising if you say,
the ability to distinguish between French and Japanese
Disturbed your apps' ability to tell which way it was magnetic north.
And although this particular example is not real
(for the relief of frankophones in Hokkaido),
There are situations where a Swift addiction
can change how your app behaves ̵
even if you are not using it directly .
In this week's article,
We see in some ways that imported modules can
change the silence of existing code,
and suggest how to
prevent this from happening as an API provider
and reducing the effect of this as an API consumer.
There is a story that is old as
two things are called
and the compiler needs to decide what to do.
Pretty much every language with a mechanism for code reuse
has to deal with naming collisions in one way or another.
In the case of Swift,
You can use fully qualified names to differentiate
Foo type declared in module
Foo type in module
However, Swift has some unique features
This causes other ambiguities to go unnoticed by the compiler,
which can lead to changes in existing behavior
when modules are imported.
+ operator denotes pairing
when the operands are arrays.
A selection plus another result in
a series of elements of the former group followed by the latter.
Two Three : [ Int ] ]  ] 3 ] fire Fem Sex : [