@@ -23,8 +23,18 @@ use feature 'lexical_require`;
2323use Some::Module;
2424```
2525
26- With the above, code outside of the above scope cannot see `Some::Module` unless
27- it explicitly requires it.
26+ Within a given lexical scope, **ß**, if the ' lexical_require' feature is used,
27+ code outside of scope **ß** cannot call methods against class names that have
28+ not been explicitly required within the current package, and doing so would
29+ throw an exception. Methods would be allowed against any object (blessed
30+ reference), but not against a class.
31+
32+ Note: that doesn' t mean the transitive dependencies aren' t available. If
33+ scope **ß** uses `lexical_require` and `Hash::Ordered`, but scope **∂** uses
34+ `Hash::Ordered` but _doesn' t_ use ` lexical_require` , then ` Hash::Ordered` is
35+ still available to everyone as a transitive dependency. However, individual module
36+ authors will still have greater safety in knowing that people are not directly
37+ relying on their internals.
2838
2939# # Motivation
3040
@@ -70,6 +80,14 @@ my $object = Some::Class->new; # succeeds if `Some::Class` has a `new` method
7080my $cache = Hash::Ordered->new; # fails
7181` ` `
7282
83+ Note that, if possible, this should also apply to package variables. In the
84+ above, ` $Hash::Ordered::VERSION ` should fail. This is again, to prevent
85+ accidentally relying on code that might not be there. If ` Foo` switches from
86+ ` Hash::Ordered` to a similar module, all code relying on ` Hash::Ordered` as a
87+ transitive dependency would break. As a module author, I don' t want to break
88+ someone else' s code just because I changed internal details that they should
89+ not know about.
90+
7391# # Backwards Compatibility
7492
7593This feature should be 100% backwards compatible for new code. If retrofitted
0 commit comments