<p dir="auto"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter" rel="nofollow"><code class="notranslate">Intl.Segmenter</code></a> is available at runtime, but usage creates a compiler error in Deno v<code class="notranslate">1.20.4</code>:</p>
<p dir="auto"><code class="notranslate">example.ts</code>:</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="const segmenter = new Intl.Segmenter(&quot;en&quot;, { granularity: &quot;grapheme&quot; });

console.log({ denoVersion: Deno.version.deno, segmenter });
"><pre class="notranslate"><span class="pl-k">const</span> <span class="pl-s1">segmenter</span> <span class="pl-c1">=</span> <span class="pl-k">new</span> <span class="pl-smi">Intl</span><span class="pl-kos">.</span><span class="pl-c1">Segmenter</span><span class="pl-kos">(</span><span class="pl-s">"en"</span><span class="pl-kos">,</span> <span class="pl-kos">{</span> <span class="pl-c1">granularity</span>: <span class="pl-s">"grapheme"</span> <span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span>

<span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-en">log</span><span class="pl-kos">(</span><span class="pl-kos">{</span> <span class="pl-c1">denoVersion</span>: <span class="pl-smi">Deno</span><span class="pl-kos">.</span><span class="pl-c1">version</span><span class="pl-kos">.</span><span class="pl-c1">deno</span><span class="pl-kos">,</span> segmenter <span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ deno run example.ts
Check file:///Users/deno/example.ts
error: TS2339 [ERROR]: Property 'Segmenter' does not exist on type 'typeof Intl'.
const segmenter = new Intl.Segmenter(&quot;en&quot;, { granularity: &quot;grapheme&quot; });
                           ~~~~~~~~~
    at file:///Users/deno/example.ts:1:28"><pre class="notranslate"><code class="notranslate">$ deno run example.ts
Check file:///Users/deno/example.ts
error: TS2339 [ERROR]: Property 'Segmenter' does not exist on type 'typeof Intl'.
const segmenter = new Intl.Segmenter("en", { granularity: "grapheme" });
                           ~~~~~~~~~
    at file:///Users/deno/example.ts:1:28
</code></pre></div>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ deno run --no-check example.ts
{ denoVersion: &quot;1.20.4&quot;, segmenter: Intl.Segmenter {} }"><pre class="notranslate"><code class="notranslate">$ deno run --no-check example.ts
{ denoVersion: "1.20.4", segmenter: Intl.Segmenter {} }
</code></pre></div>
<p dir="auto">What are the interactions between these methods:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Process#close()
Process#kill(signal)
Process#status()"><pre class="notranslate"><code class="notranslate">Process#close()
Process#kill(signal)
Process#status()
</code></pre></div>
<p dir="auto">The existing docs or a quick read of the source say that:</p>
<ol dir="auto">
<li>
<p dir="auto">calling <code class="notranslate">status()</code> after <code class="notranslate">Process#kill(signal)</code> should still be ok (and is).</p>
</li>
<li>
<p dir="auto">calling <code class="notranslate">status()</code> after <code class="notranslate">Process#close()</code> will fail with <code class="notranslate">BadResource: bad resource id</code>. So too will calling <code class="notranslate">close()</code> after <code class="notranslate">close()</code>.</p>
</li>
<li>
<p dir="auto">Because of 1 and 2, presumably <code class="notranslate">Process#kill</code> doesn't (and shouldn't) implicitly invoke <code class="notranslate">Process#close</code>.</p>
</li>
<li>
<p dir="auto">What if <code class="notranslate">Process#close</code> is invoked, and the process is still running? Would we expect this to <code class="notranslate">kill</code> the Process, or not? Currently it doesn't seem to do so, and perhaps that's the right design. Just wanted to make the behavior explicit.</p>
</li>
<li>
<p dir="auto">Currently nothing stops us from <code class="notranslate">Process#kill</code>ing a Process that has already exited. If you're lucky, your OS will complain. If you're unlucky, the <code class="notranslate">pid</code> may have been recycled, and you'll be signaling some unknown new process. Wouldn't it be nicer for Deno to verify that if you call <code class="notranslate">Process#kill</code>, the Process hasn't already exited (either naturally, or because you or someone else killed it)?</p>
<p dir="auto">One way to do that would be to run the <code class="notranslate">sendAsync(dispatch.OP_RUN_STATUS, {rid})</code> on every Process right after it's started, and have the resulting Promise set a flag, which blocks <code class="notranslate">Process#kill</code>. If that seems too resource-intensive to do across the board, perhaps there's a way to make sure it's at least been done first, in those cases the user requests to <code class="notranslate">kill</code> the Process (or queries its status)?</p>
</li>
</ol>
<p dir="auto">Next, what are the interactions of the above methods with these:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Process#output()
Process#stderrOutput()
Process#stdin|stdout|stderr.close()"><pre class="notranslate"><code class="notranslate">Process#output()
Process#stderrOutput()
Process#stdin|stdout|stderr.close()
</code></pre></div>
<ol start="6" dir="auto">
<li>
<p dir="auto">The docs say that calling <code class="notranslate">output()</code> and <code class="notranslate">stderrOutput()</code> schedule a <code class="notranslate">stdout.close()</code> and <code class="notranslate">stderr.close()</code>, respectively, after the pipes have been read.</p>
</li>
<li>
<p dir="auto">What if <code class="notranslate">Process#close</code> is invoked, the Process has piped stdio, but <code class="notranslate">output()</code> and <code class="notranslate">stderrOutput()</code> haven't been invoked, and perhaps never will be? Do the stdio pipes get closed? If so, when: only when they're garbage collected?</p>
</li>
<li>
<p dir="auto">In general, what is appropriate clean-up for a Process? Should one always explicitly <code class="notranslate">close()</code> it? (I expect it will be <code class="notranslate">closed()</code> automatically when GC'd; though that doesn't mean we shouldn't close it ourselves when we know we're done with it.) If it has open stdio pipes that we haven't read --- perhaps because we killed the Process --- do we need to explicitly <code class="notranslate">close()</code> them before closing the Process?</p>
</li>
</ol>