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
Copy file name to clipboardExpand all lines: docs/docs/reference/contextual/contextual.md
+12-12Lines changed: 12 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -50,25 +50,25 @@ Existing Scala programmers by and large have gotten used to the status quo and s
50
50
51
51
The following pages introduce a redesign of contextual abstractions in Scala. They introduce four fundamental changes:
52
52
53
-
1.[Given Instances](./contextual/givens.md) are a new way to define basic terms that can be synthesized. They replace implicit definitions. The core principle of the proposal is that, rather than mixing the `implicit` modifier with a large number of features, we have a single way to define terms that can be synthesized for types.
53
+
1.[Given Instances](./givens.md) are a new way to define basic terms that can be synthesized. They replace implicit definitions. The core principle of the proposal is that, rather than mixing the `implicit` modifier with a large number of features, we have a single way to define terms that can be synthesized for types.
54
54
55
-
2.[Using Clauses](./contextual/using-clauses.md) are a new syntax for implicit _parameters_ and their _arguments_. It unambiguously aligns parameters and arguments, solving a number of language warts. It also allows us to have several `using` clauses in a definition.
55
+
2.[Using Clauses](./using-clauses.md) are a new syntax for implicit _parameters_ and their _arguments_. It unambiguously aligns parameters and arguments, solving a number of language warts. It also allows us to have several `using` clauses in a definition.
56
56
57
-
3.["Given" Imports](./contextual/given-imports.md) are a new class of import selectors that specifically import
57
+
3.["Given" Imports](./given-imports.md) are a new class of import selectors that specifically import
58
58
givens and nothing else.
59
59
60
-
4.[Implicit Conversions](./contextual/conversions.md) are now expressed as given instances of a standard `Conversion` class. All other forms of implicit conversions will be phased out.
60
+
4.[Implicit Conversions](./conversions.md) are now expressed as given instances of a standard `Conversion` class. All other forms of implicit conversions will be phased out.
61
61
62
62
This section also contains pages describing other language features that are related to context abstraction. These are:
63
63
64
-
-[Context Bounds](./contextual/context-bounds.md), which carry over unchanged.
65
-
-[Extension Methods](./contextual/extension-methods.md) replace implicit classes in a way that integrates better with type classes.
66
-
-[Implementing Type Classes](./contextual/type-classes.md) demonstrates how some common type classes can be implemented using the new constructs.
67
-
-[Type Class Derivation](./contextual/derivation.md) introduces constructs to automatically derive type class instances for ADTs.
68
-
-[Multiversal Equality](./contextual/multiversal-equality.md) introduces a special type class to support type safe equality.
69
-
-[Context Functions](./contextual/context-functions.md) provide a way to abstract over context parameters.
70
-
-[By-Name Context Parameters](./contextual/by-name-context-parameters.md) are an essential tool to define recursive synthesized values without looping.
71
-
-[Relationship with Scala 2 Implicits](./contextual/relationship-implicits.md) discusses the relationship between old-style implicits and new-style givens and how to migrate from one to the other.
64
+
-[Context Bounds](./context-bounds.md), which carry over unchanged.
65
+
-[Extension Methods](./extension-methods.md) replace implicit classes in a way that integrates better with type classes.
66
+
-[Implementing Type Classes](./type-classes.md) demonstrates how some common type classes can be implemented using the new constructs.
67
+
-[Type Class Derivation](./derivation.md) introduces constructs to automatically derive type class instances for ADTs.
68
+
-[Multiversal Equality](./multiversal-equality.md) introduces a special type class to support type safe equality.
69
+
-[Context Functions](./context-functions.md) provide a way to abstract over context parameters.
70
+
-[By-Name Context Parameters](./by-name-context-parameters.md) are an essential tool to define recursive synthesized values without looping.
71
+
-[Relationship with Scala 2 Implicits](./relationship-implicits.md) discusses the relationship between old-style implicits and new-style givens and how to migrate from one to the other.
72
72
73
73
Overall, the new design achieves a better separation of term inference from the rest of the language: There is a single way to define givens instead of a multitude of forms all taking an `implicit` modifier. There is a single way to introduce implicit parameters and arguments instead of conflating implicit with normal arguments. There is a separate way to import givens that does not allow them to hide in a sea of normal imports. And there is a single way to define an implicit conversion which is clearly marked as such and does not require special syntax.
2.[Compile-time ops](./metaprogramming/compiletime-ops.md) are helper definitions in the
21
+
2.[Compile-time ops](./compiletime-ops.md) are helper definitions in the
22
22
standard library that provide support for compile-time operations over values and types.
23
23
24
-
3.[Macros](./metaprogramming/macros.md) are built on two well-known fundamental
24
+
3.[Macros](./macros.md) are built on two well-known fundamental
25
25
operations: quotation and splicing. Quotation converts program code to
26
26
data, specifically, a (tree-like) representation of this code. It is
27
27
expressed as `'{...}` for expressions and as `'[...]` for types. Splicing,
28
28
expressed as `${ ... }`, goes the other way: it converts a program's representation
29
29
to program code. Together with `inline`, these two abstractions allow
30
30
to construct program code programmatically.
31
31
32
-
4.[Runtime Staging](./metaprogramming/staging.md) Where macros construct code at _compile-time_,
32
+
4.[Runtime Staging](./staging.md) Where macros construct code at _compile-time_,
33
33
staging lets programs construct new code at _runtime_. That way,
34
34
code generation can depend not only on static data but also on data available at runtime. This splits the evaluation of the program in two or more phases or ...
35
35
stages. Consequently, this method of generative programming is called "Multi-Stage Programming". Staging is built on the same foundations as macros. It uses
36
36
quotes and splices, but leaves out `inline`.
37
37
38
-
5.[Reflection](./metaprogramming/reflection.md) Quotations are a "black-box"
38
+
5.[Reflection](./reflection.md) Quotations are a "black-box"
39
39
representation of code. They can be parameterized and composed using
40
40
splices, but their structure cannot be analyzed from the outside. TASTy
41
41
reflection gives a way to analyze code structure by partly revealing the representation type of a piece of code in a standard API. The representation
42
42
type is a form of typed abstract syntax tree, which gives rise to the `TASTy`
43
43
moniker.
44
44
45
-
6.[TASTy Inspection](./metaprogramming/tasty-inspect.md) Typed abstract syntax trees are serialized
45
+
6.[TASTy Inspection](./tasty-inspect.md) Typed abstract syntax trees are serialized
46
46
in a custom compressed binary format stored in `.tasty` files. TASTy inspection allows
47
47
to load these files and analyze their content's tree structure.
0 commit comments