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: overviews/macros/typeproviders.md
+4-4Lines changed: 4 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -28,7 +28,7 @@ and won't require its presence at compile-time or at runtime.
28
28
Recently we've given a talk about macro-based type providers in Scala, summarizing the state of the art and providing
29
29
concrete examples. Slides and accompanying code can be found at [https://github.com/travisbrown/type-provider-examples](https://github.com/travisbrown/type-provider-examples).
30
30
31
-
## Type providers
31
+
## Introduction
32
32
33
33
Type providers are a strongly-typed type-bridging mechanism, which enables information-rich programming in F# 3.0.
34
34
A type provider is a compile-time facility, which is capable of generating definitions and their implementations
@@ -46,7 +46,7 @@ are local in the sense that the scope of their expansions is limited: [https://g
46
46
1. Make generated definitions optionally erasable (Scala supports erasure for a number of language constructs,
47
47
e.g. for abstract type members and value classes, but the mechanism is not extensible, which means that macro writers can't customize it).
48
48
49
-
###Anonymous type providers
49
+
## Anonymous type providers
50
50
51
51
Even though the scope of definitions introduced by expansions of def macros is limited to those expansions,
52
52
these definitions can escape their scopes by turning into structural types. For instance, consider the `h2db` macro that
@@ -87,7 +87,7 @@ it has performance problems caused by the fact that Scala emits reflective calls
87
87
of structural types. There are several strategies of dealing with that, but this margin is too narrow to contain them
88
88
so I refer you to an amazing blog series by Travis Brown for details: [post 1](http://meta.plasm.us/posts/2013/06/19/macro-supported-dsls-for-schema-bindings/), [post 2](http://meta.plasm.us/posts/2013/07/11/fake-type-providers-part-2/), [post 3](http://meta.plasm.us/posts/2013/07/12/vampire-methods-for-structural-types/).
89
89
90
-
###Public type providers
90
+
## Public type providers
91
91
92
92
With the help of [macro paradise](/overviews/macros/paradise.html) and its [macro annotations](/overviews/macros/annotations.html), it becomes
93
93
possible to easily generate publicly visible classes, without having to apply workarounds based on structural types. The annotation-based
@@ -134,7 +134,7 @@ than bytecode of a full-fledged class. This technique applies to both anonymous
134
134
}
135
135
}
136
136
137
-
###Blackbox vs whitebox
137
+
## Blackbox vs whitebox
138
138
139
139
Both anonymous and public type providers must be [whitebox](/overviews/macros/blackbox-whitebox.html).
140
140
If you declare a type provider macro as [blackbox](/overviews/macros/blackbox-whitebox.html), it will not work.
0 commit comments