You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Motivation
The error the the compiler emits when attempting to use a non-public Library member is too opaque and could be more helpful. 'Cannot find 'XXX' in scope' It doesn't help the user understand what's wrong, and is quite confusing for learners, or people new to Swift. (Also sometimes confusing for non-neophytes as well!)
Solution
I assume that the compiler knows that the type exists and that it is not marked as Public, as in Xcode one can Command-click the type and the user is taken to the definition.
If the user tries to use a non-public member from a library, perhaps give a fix-it message that helps the user understand what's wrong, such as 'Attempting to use non-public member. XXX is private and not available in this scope.'.
Alternatives considered
None, but I don't understand how compilers work!
Motivation
The error the the compiler emits when attempting to use a non-public Library member is too opaque and could be more helpful.
'Cannot find 'XXX' in scope'It doesn't help the user understand what's wrong, and is quite confusing for learners, or people new to Swift. (Also sometimes confusing for non-neophytes as well!)Solution
I assume that the compiler knows that the type exists and that it is not marked as Public, as in Xcode one can Command-click the type and the user is taken to the definition.
If the user tries to use a non-public member from a library, perhaps give a fix-it message that helps the user understand what's wrong, such as
'Attempting to use non-public member. XXX is private and not available in this scope.'.Alternatives considered
None, but I don't understand how compilers work!
Additional context
See here for Forums discussion:
https://forums.swift.org/t/error-when-attempting-to-use-non-public-library-member-is-too-opaque-and-could-be-more-helpful/66840/1
The text was updated successfully, but these errors were encountered: