A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://scala-lang.org/api/3.x/scala/runtime/stdLibPatches/language$$adhocExtensions$.html below:

adhocExtensions

scala.runtime.stdLibPatches.language.adhocExtensions

Where imported, ad hoc extensions of non-open classes in other compilation units are allowed.

'''Why control the feature?''' Ad-hoc extensions should usually be avoided since they typically cannot rely on an "internal" contract between a class and its extensions. Only open classes need to specify such a contract. Ad-hoc extensions might break for future versions of the extended class, since the extended class is free to change its implementation without being constrained by an internal contract.

'''Why allow it?''' An ad-hoc extension can sometimes be necessary, for instance when mocking a class in a testing framework, or to work around a bug or missing feature in the original class. Nevertheless, such extensions should be limited in scope and clearly documented. That's why the language import is required for them.

Attributes
Source
language.scala
Graph
Supertypes
Self type

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4