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/wrapper-layer.md
+7-7Lines changed: 7 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -1,13 +1,13 @@
1
-
The OmnICU Wrapper Layer
2
-
========================
1
+
The ICU for X Wrapper Layer
2
+
===========================
3
3
4
-
A key piece of rolling out ergonomic OmnICU APIs for Rust and other target languages is the *wrapper layer*: code that sits between the client and the lower-level OmnICU libraries. This document explains the design behind the OmnICU wrapper layer.
4
+
A key piece of rolling out ergonomic *ICU for X*APIs for Rust and other target languages is the *wrapper layer*: code that sits between the client and the lower-level *ICU for X*libraries. This document explains the design behind the *ICU for X* wrapper layer.
5
5
6
6
## Background
7
7
8
8
### Ergonomic API versus Logical API
9
9
10
-
When a programmer writes code using Intl, the code they write should demonstrate their *intent*. They should use what I'm calling the *ergonomic API* of OmnICU.
10
+
When a programmer writes code using Intl, the code they write should demonstrate their *intent*. They should use what I'm calling the *ergonomic API* of *ICU for X*.
11
11
12
12
A *logical API*, on the other hand, is one that is closely tied to specific to functional units, like currencies or measurement units. A logical API function should require a specific hunk of data specific to the functional unit and perform a specific task.
13
13
@@ -25,7 +25,7 @@ Rule of thumb: A good "ergonomic" API is one that makes the "business logic" of
25
25
26
26
### Host Language
27
27
28
-
Since the ergonomic API depends on the host language (e.g., Objective-C calling into OmnICU via an FFI), the wrapper layer should be written in each individual host language, mapping to the logical API exported by the OmnICU library.
28
+
Since the ergonomic API depends on the host language (e.g., Objective-C calling into *ICU for X*via an FFI), the wrapper layer should be written in each individual host language, mapping to the logical API exported by the *ICU for X* library.
29
29
30
30
This allows different languages to choose different styles for passing options into the library; for example, a Builder pattern could be used in Java, and an options bag could be used in JavaScript.
31
31
@@ -50,8 +50,8 @@ This model decouples the data provider from the core business logic; with calls
50
50
51
51
### Limited Amount of Code
52
52
53
-
One of the strengths of OmnICU is that the core business logic is written once and shared by many different environments.
53
+
One of the strengths of *ICU for X* is that the core business logic is written once and shared by many different environments.
54
54
55
55
Since the wrapper layer needs to be implemented separately for each host language, as much business logic as possible should be moved into the logical API. The wrapper layer should transform from the ergonomic API to the logical API and load the required data for the logical API; nothing more.
56
56
57
-
A transpilation or IDL approach could be considered as options for generating the binding logic. Main issues: [#1](https://github.com/unicode-org/omnicu/issues/1), [#2](https://github.com/unicode-org/omnicu/issues/2).
57
+
A transpilation or IDL approach could be considered as options for generating the binding logic. Main issues: [#1](https://github.com/unicode-org/icu4x/issues/1), [#2](https://github.com/unicode-org/icu4x/issues/2).
0 commit comments