Skip to content

Commit 85e1639

Browse files
authored
Copy user story from #524 to design doc (#528)
Per a comment from @stasm, saving a user story from a comment in #524 into the design doc.
1 parent 3cd280b commit 85e1639

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

exploration/overriding-extending-namespacing.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,45 @@ _What use-cases do we see? Ideally, quote concrete examples._
101101
- Translators and tools would like a machine-readable way to find out the names
102102
and option values for add-on packages.
103103

104+
---
105+
106+
_A user story_
107+
108+
Suppose you're you're creating the ICU4J implementation.
109+
The `:datetime` function in the default registry might be
110+
backed by `com.ibm.icu.text.DateFormat` as an implementing class.
111+
There's no need to prefix `:datetime` for that.
112+
That's just in the implementation.
113+
114+
The same developer might want to expose ICU4J's `skeleton` feature
115+
(which uses `DateTimePatternGenerator` to create a pattern).
116+
That's not a default registry option.
117+
So she should prefix the _option_ as `icu:skeleton` in her implementation.
118+
119+
Suppose the same developer then goes on to implement `com.ibm.icu.text.DateIntervalFormat`
120+
as a function.
121+
That's not in the default registry, so it gets `:icu:dateinterval`.
122+
The _options_ for this function might or might not be namespaced.
123+
124+
Suppose the same developer goes on to implement an SPI for custom functions.
125+
Suppose an ICU4J user writes her own date formatter.
126+
It doesn't replace the one in `:dateformat`, so it gets a prefix like `:my:dateformat`.
127+
The standard options might not be prefixed, but custom options (similar to `skeleton` above) would be.
128+
ICU's options would probably not be recognized.
129+
130+
In such an implementation, users could write expressions such as:
131+
132+
```
133+
{$now :datetime icu:skeleton=yMMMd}
134+
{$now :icu:dateinterval end=$then skeleton=yMMM}
135+
{$now :my:datetime dateStyle=short :my:wonderfulness=high}
136+
```
137+
138+
Suppose a tool implementer is working with messages written for the above implementation with the `my` add-on.
139+
When they see a namespace prefix, that tells them that the function or the option is non-standard.
140+
The prefix might tell them where to look for the add-on registry
141+
or at least be something that they can key locally.
142+
104143
## Requirements
105144

106145
_What properties does the solution have to manifest to enable the use-cases above?_

0 commit comments

Comments
 (0)