<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Hacker News: throwitaway1123</title><link>https://news.ycombinator.com/user?id=throwitaway1123</link><description>Hacker News RSS</description><docs>https://hnrss.org/</docs><generator>hnrss v2.1.1</generator><lastBuildDate>Sun, 05 Apr 2026 20:37:04 +0000</lastBuildDate><atom:link href="https://hnrss.org/user?id=throwitaway1123" rel="self" type="application/rss+xml"></atom:link><item><title><![CDATA[New comment by throwitaway1123 in "Dynamically patch a Python function's source code at runtime"]]></title><description><![CDATA[
<p>There's actually a library called ast-grep which does something very similar to what you're describing. They have an example in their introduction which performs a find and replace operation on a JS AST using a pattern:<p><pre><code>  ast-grep --pattern 'var code = $PAT' --rewrite 'let code = $PAT' --lang js

</code></pre>
<a href="https://ast-grep.github.io/guide/introduction.html" rel="nofollow">https://ast-grep.github.io/guide/introduction.html</a></p>
]]></description><pubDate>Sun, 24 Aug 2025 19:40:29 +0000</pubDate><link>https://news.ycombinator.com/item?id=45007062</link><dc:creator>throwitaway1123</dc:creator><comments>https://news.ycombinator.com/item?id=45007062</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=45007062</guid></item><item><title><![CDATA[New comment by throwitaway1123 in "The Future of JavaScript: What Awaits Us"]]></title><description><![CDATA[
<p>For anyone looking for context on smooshgate: <a href="https://developer.chrome.com/blog/smooshgate" rel="nofollow">https://developer.chrome.com/blog/smooshgate</a></p>
]]></description><pubDate>Wed, 20 Aug 2025 21:22:09 +0000</pubDate><link>https://news.ycombinator.com/item?id=44966624</link><dc:creator>throwitaway1123</dc:creator><comments>https://news.ycombinator.com/item?id=44966624</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=44966624</guid></item><item><title><![CDATA[New comment by throwitaway1123 in "Left to Right Programming"]]></title><description><![CDATA[
<p>Yes, as you pointed out, not only can bundlers tree shake namespace imports, but they're literally used in the esbuild documentation to demonstrate the concept of tree shaking.<p>The issue you linked to is referring to the case in which you import a namespace object and then re-export it. Bundlers like webpack and rollup (which vite uses in production) can tree shake this pattern as well, but esbuild struggles with it.<p>If you're using esbuild instead of this:<p><pre><code>  import * as someLibrary from "some-library"
  someLibrary.someFunction()
  export { someLibrary }
</code></pre>
You can still do this:<p><pre><code>  import * as someLibrary from "some-library"
  someLibrary.someFunction()
  export * from "some-library"
  export { default as someLibraryDefault } from "some-library"
  
</code></pre>
Tree shaking works as expected for downstream packages using esbuild in the second case, which someone else in the linked issue pointed out: <a href="https://github.com/evanw/esbuild/issues/1420#issuecomment-961323828" rel="nofollow">https://github.com/evanw/esbuild/issues/1420#issuecomment-96...</a></p>
]]></description><pubDate>Tue, 19 Aug 2025 18:22:11 +0000</pubDate><link>https://news.ycombinator.com/item?id=44954602</link><dc:creator>throwitaway1123</dc:creator><comments>https://news.ycombinator.com/item?id=44954602</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=44954602</guid></item><item><title><![CDATA[New comment by throwitaway1123 in "Left to Right Programming"]]></title><description><![CDATA[
<p>Alternatively, with namespace imports in JS you can write [1]:<p><pre><code>  import * as someLibrary from "some-library"
  someLibrary.someFunction()
</code></pre>
Which works pretty well with IDE autocomplete in my experience.<p>[1] <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import#namespace_import" rel="nofollow">https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...</a></p>
]]></description><pubDate>Mon, 18 Aug 2025 22:03:49 +0000</pubDate><link>https://news.ycombinator.com/item?id=44945796</link><dc:creator>throwitaway1123</dc:creator><comments>https://news.ycombinator.com/item?id=44945796</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=44945796</guid></item><item><title><![CDATA[New comment by throwitaway1123 in "Node.js is able to execute TypeScript files without additional configuration"]]></title><description><![CDATA[
<p>Somewhat related: you technically can access some type metadata in TypeScript at runtime using the `emitDecoratorMetadata` and `experimentalDecorators` tsconfig options, along with Microsoft's `reflect-metadata` polyfill package. There was a trend at one point where people were writing database ORMs using decorator metadata (e.g. Typegoose, TypeORM, and MikroORM).<p>This of course requires your build tool to actually understand the TS type system, which is why it's not supported in tools like esbuild and tsx (which uses esbuild under the hood).</p>
]]></description><pubDate>Sun, 17 Aug 2025 21:09:47 +0000</pubDate><link>https://news.ycombinator.com/item?id=44934967</link><dc:creator>throwitaway1123</dc:creator><comments>https://news.ycombinator.com/item?id=44934967</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=44934967</guid></item><item><title><![CDATA[New comment by throwitaway1123 in "Comptime.ts: compile-time expressions for TypeScript"]]></title><description><![CDATA[
<p>> I do wonder if this makes the importable gets (via type: json) a reality like assert was going to.<p>Yes, the JSON modules proposal is finished.<p><a href="https://github.com/tc39/proposal-json-modules" rel="nofollow">https://github.com/tc39/proposal-json-modules</a><p><a href="https://caniuse.com/mdn-javascript_statements_import_import_attributes_type_json" rel="nofollow">https://caniuse.com/mdn-javascript_statements_import_import_...</a></p>
]]></description><pubDate>Wed, 06 Aug 2025 22:02:30 +0000</pubDate><link>https://news.ycombinator.com/item?id=44818378</link><dc:creator>throwitaway1123</dc:creator><comments>https://news.ycombinator.com/item?id=44818378</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=44818378</guid></item><item><title><![CDATA[New comment by throwitaway1123 in "Modern Node.js Patterns"]]></title><description><![CDATA[
<p>Which browsers have you tested this in? I ran the feature detection script from the Chrome docs and neither Safari nor Firefox seem to support fetch upload streaming: <a href="https://developer.chrome.com/docs/capabilities/web-apis/fetch-streaming-requests#feature_detection" rel="nofollow">https://developer.chrome.com/docs/capabilities/web-apis/fetc...</a><p><pre><code>  const supportsRequestStreams = (() => {
    let duplexAccessed = false;
  
    const hasContentType = new Request('http://localhost', {
      body: new ReadableStream(),
      method: 'POST',
      get duplex() {
        duplexAccessed = true;
        return 'half';
      },
    }).headers.has('Content-Type');
  
    return duplexAccessed && !hasContentType;
  })();
</code></pre>
Safari doesn't appear to support the duplex option (the duplex getter is never triggered), and Firefox can't even handle a stream being used as the body of a Request object, and ends up converting the body to a string, and then setting the content type header to 'text/plain'.</p>
]]></description><pubDate>Mon, 04 Aug 2025 13:59:01 +0000</pubDate><link>https://news.ycombinator.com/item?id=44785851</link><dc:creator>throwitaway1123</dc:creator><comments>https://news.ycombinator.com/item?id=44785851</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=44785851</guid></item><item><title><![CDATA[New comment by throwitaway1123 in "Modern Node.js Patterns"]]></title><description><![CDATA[
<p>Enums and parameter properties can be enabled with the --experimental-transform-types CLI option.<p>Not being able to import TypeScript files without including the ts extension is definitely annoying. The rewriteRelativeImportExtensions tsconfig option added in TS 5.7 made it much more bearable though. When you enable that option not only does the TS compiler stop complaining when you specify the '.ts' extension in import statements (just like the allowImportingTsExtensions option has always allowed), but it also rewrites the paths if you compile the files, so that the build artifacts have the correct js extension: <a href="https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-7.html#path-rewriting-for-relative-paths" rel="nofollow">https://www.typescriptlang.org/docs/handbook/release-notes/t...</a></p>
]]></description><pubDate>Mon, 04 Aug 2025 01:03:50 +0000</pubDate><link>https://news.ycombinator.com/item?id=44781211</link><dc:creator>throwitaway1123</dc:creator><comments>https://news.ycombinator.com/item?id=44781211</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=44781211</guid></item><item><title><![CDATA[New comment by throwitaway1123 in "Modern Node.js Patterns"]]></title><description><![CDATA[
<p>In Node 22.7 and above you can enable features like enums and parameter properties with the --experimental-transform-types CLI option (not to be confused with the old --experimental-strip-types option).</p>
]]></description><pubDate>Mon, 04 Aug 2025 00:43:28 +0000</pubDate><link>https://news.ycombinator.com/item?id=44781127</link><dc:creator>throwitaway1123</dc:creator><comments>https://news.ycombinator.com/item?id=44781127</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=44781127</guid></item><item><title><![CDATA[New comment by throwitaway1123 in "Deno 2.4"]]></title><description><![CDATA[
<p>Node does have a permissions system, but it's opt in. Many runtimes/interpreters either have no sandbox at all, or they're opt in, which is why Deno's sandbox is an upgrade, even if it's not as hardened as iptables or Linux namespaces.</p>
]]></description><pubDate>Mon, 07 Jul 2025 19:52:32 +0000</pubDate><link>https://news.ycombinator.com/item?id=44494016</link><dc:creator>throwitaway1123</dc:creator><comments>https://news.ycombinator.com/item?id=44494016</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=44494016</guid></item><item><title><![CDATA[New comment by throwitaway1123 in "Deno 2.4"]]></title><description><![CDATA[
<p>> you can't just allow exact what you need in that category? You have to allow the entire category and then deny everything you don't want/need?<p>No, you can allow access to specific domains, IP addresses, filesystem paths, environment variables, etc, while denying everything else by default. You can for instance allow access to only a specific IP (e.g. `deno run --allow-net='127.0.0.1' main.ts`), while implicitly blocking every other IP.<p>What the commenter is complaining about is the fact that Deno doesn't check which IP address a domain name actually resolves to using DNS resolution. So if you explicitly deny '1.1.1.1', and the script you're running fetches from a domain with an A record pointing to '1.1.1.1', Deno will allow it.<p>In practice, I usually use allow lists rather than deny lists, because I very rarely have an exhaustive list on hand of every IP address or domain I'm expecting a rogue script to attempt to access.</p>
]]></description><pubDate>Mon, 07 Jul 2025 19:41:48 +0000</pubDate><link>https://news.ycombinator.com/item?id=44493924</link><dc:creator>throwitaway1123</dc:creator><comments>https://news.ycombinator.com/item?id=44493924</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=44493924</guid></item><item><title><![CDATA[New comment by throwitaway1123 in "What should a native DOM templating API look like?"]]></title><description><![CDATA[
<p>The repeat directive I mentioned as an example of a custom looping control flow construct used in a tagged template is the exact same one another commenter later mentioned (and you responded to) here by the way: <a href="https://news.ycombinator.com/item?id=44441002">https://news.ycombinator.com/item?id=44441002</a></p>
]]></description><pubDate>Wed, 02 Jul 2025 17:40:59 +0000</pubDate><link>https://news.ycombinator.com/item?id=44446619</link><dc:creator>throwitaway1123</dc:creator><comments>https://news.ycombinator.com/item?id=44446619</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=44446619</guid></item><item><title><![CDATA[New comment by throwitaway1123 in "What should a native DOM templating API look like?"]]></title><description><![CDATA[
<p>I certainly don't think I'm talking past you, but I can't force you to elaborate.</p>
]]></description><pubDate>Wed, 02 Jul 2025 03:38:17 +0000</pubDate><link>https://news.ycombinator.com/item?id=44440055</link><dc:creator>throwitaway1123</dc:creator><comments>https://news.ycombinator.com/item?id=44440055</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=44440055</guid></item><item><title><![CDATA[New comment by throwitaway1123 in "What should a native DOM templating API look like?"]]></title><description><![CDATA[
<p>JSX was also created with the intention of using traditional conditional/looping constructs, but that hasn't stopped Solid and Preact from repurposing it for fine grained reactivity. Preact's signal implementation has Solid-like Show/For components [1].<p>I won't speak for the author of the proposal, but given that Lit itself has special control flow mechanisms for conditionals and loops (the cache and repeat directives respectively [2][3]), I can't imagine the proposal being too opposed to these mechanisms.<p>[1] <a href="https://github.com/preactjs/signals/blob/eae850a9f3aa62e505a316597c27814dd70be9de/packages/react/README.md#show-component">https://github.com/preactjs/signals/blob/eae850a9f3aa62e505a...</a><p>[2] <a href="https://lit.dev/docs/templates/conditionals/#caching-template-results:-the-cache-directive" rel="nofollow">https://lit.dev/docs/templates/conditionals/#caching-templat...</a><p>[3] <a href="https://lit.dev/docs/templates/lists/#the-repeat-directive" rel="nofollow">https://lit.dev/docs/templates/lists/#the-repeat-directive</a></p>
]]></description><pubDate>Wed, 02 Jul 2025 00:57:27 +0000</pubDate><link>https://news.ycombinator.com/item?id=44439324</link><dc:creator>throwitaway1123</dc:creator><comments>https://news.ycombinator.com/item?id=44439324</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=44439324</guid></item><item><title><![CDATA[New comment by throwitaway1123 in "What should a native DOM templating API look like?"]]></title><description><![CDATA[
<p>> This is why both SolidJS and Vue Vapor both have helpers for rendering lists and conditional elements<p>Haven't these tagged template libraries coalesced around the html`<${SomeComponent}><//>` syntax for custom components (including control flow components like Solid's `For` component)? The readme for Ryan Carniato's Lit DOM Expressions library includes this example for instance [1]:<p><pre><code>  const view = html`
    <table class="table table-hover table-striped test-data">
      <tbody>
        <${For} each=${() => state.data}
          >${row => html`
            <tr>
              <td class="col-md-1" textContent=${row.id} />
              <td class="col-md-4">
                <a onClick=${[select, row.id]}>${() => row.label}</a>
              </td>
              <td class="col-md-1">
                <a onClick=${[remove, row.id]}
                  ><span class="glyphicon glyphicon-remove"
                /></a>
              </td>
              <td class="col-md-6" />
            </tr>
          `}<//
        >
      </tbody>
    </table>
  `;
</code></pre>
The author of the article mentions this very briefly, where he writes "For JSX-style references you would need to use binding syntax like <${MyComponent}>". The Preact author's htm tagged template library uses this convention as well [2].<p>[1] <a href="https://github.com/ryansolid/dom-expressions/tree/7fd9f86f1b3cb23594f124bb3f2d2295db4494c9/packages/lit-dom-expressions">https://github.com/ryansolid/dom-expressions/tree/7fd9f86f1b...</a><p>[2] <a href="https://github.com/developit/htm">https://github.com/developit/htm</a></p>
]]></description><pubDate>Tue, 01 Jul 2025 23:16:05 +0000</pubDate><link>https://news.ycombinator.com/item?id=44438815</link><dc:creator>throwitaway1123</dc:creator><comments>https://news.ycombinator.com/item?id=44438815</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=44438815</guid></item><item><title><![CDATA[New comment by throwitaway1123 in "The time is right for a DOM templating API"]]></title><description><![CDATA[
<p>You clearly have an axe to grind, and I'm not particularly interested in proselytizing. If you don't find the Declarative Shadow DOM useful, that's fine!<p>The example I was responding to was using the Declarative Shadow DOM. My comment was intended to point out the simple fact that the imperative component definition the author was complaining about is superfluous, meaning you can safely remove that entire script from the example.</p>
]]></description><pubDate>Sat, 28 Jun 2025 22:10:21 +0000</pubDate><link>https://news.ycombinator.com/item?id=44408572</link><dc:creator>throwitaway1123</dc:creator><comments>https://news.ycombinator.com/item?id=44408572</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=44408572</guid></item><item><title><![CDATA[New comment by throwitaway1123 in "The time is right for a DOM templating API"]]></title><description><![CDATA[
<p>> First off, what’s with the pointless JavaScript? There’s no need for imperative code here.<p>Exactly, I'm not sure why you've included the JS. The whole point of the Declarative Shadow DOM is to create shadow roots declaratively, rather than imperatively. To quote web.dev "This gives us the benefits of Shadow DOM's encapsulation and slot projection in static HTML. No JavaScript is needed to produce the entire tree, including the Shadow Root." [1]<p>[1] <a href="https://web.dev/articles/declarative-shadow-dom#how_to_build_a_declarative_shadow_root:~:text=This%20gives%20us%20the%20benefits%20of%20Shadow%20DOM%27s%20encapsulation%20and%20slot%20projection%20in%20static%20HTML.%20No%20JavaScript%20is%20needed%20to%20produce%20the%20entire%20tree%2C%20including%20the%20Shadow%20Root" rel="nofollow">https://web.dev/articles/declarative-shadow-dom#how_to_build...</a>.</p>
]]></description><pubDate>Sat, 28 Jun 2025 17:46:53 +0000</pubDate><link>https://news.ycombinator.com/item?id=44406656</link><dc:creator>throwitaway1123</dc:creator><comments>https://news.ycombinator.com/item?id=44406656</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=44406656</guid></item><item><title><![CDATA[New comment by throwitaway1123 in "The time is right for a DOM templating API"]]></title><description><![CDATA[
<p>You absolutely can. It's the primary purpose of the DSD (Declarative Shadow DOM), one of the many new specifications people complain incessantly about.<p><pre><code>  <my-component>
    <template shadowrootmode="open">
      <style>
        ::slotted(*) {
          font-weight: bold;
          font-family: sans-serif;
        }
      </style>
      <slot></slot>
    </template>
    <p>content</p>
  </my-component></code></pre></p>
]]></description><pubDate>Sat, 28 Jun 2025 17:42:07 +0000</pubDate><link>https://news.ycombinator.com/item?id=44406616</link><dc:creator>throwitaway1123</dc:creator><comments>https://news.ycombinator.com/item?id=44406616</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=44406616</guid></item><item><title><![CDATA[New comment by throwitaway1123 in "Plain Vanilla Web"]]></title><description><![CDATA[
<p>> you have to explicitly specify mode: open<p>The mode does not toggle the shadow DOM on and off. It just specifies whether or not the element's shadowRoot object is a public property. An open mode makes this possible: `document.querySelector('my-component').shadowRoot`.<p>You have to explicitly opt-in to the shadow DOM either imperatively by calling `attachShadow`, or declaratively in HTML by giving the element a template child element with a `shadowrootmode` attribute.</p>
]]></description><pubDate>Sun, 11 May 2025 19:41:40 +0000</pubDate><link>https://news.ycombinator.com/item?id=43956482</link><dc:creator>throwitaway1123</dc:creator><comments>https://news.ycombinator.com/item?id=43956482</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=43956482</guid></item><item><title><![CDATA[New comment by throwitaway1123 in "Rust’s dependencies are starting to worry me"]]></title><description><![CDATA[
<p>It's worth pointing out that Node has a built in globbing function: <a href="https://nodejs.org/docs/latest-v24.x/api/fs.html#fspromisesglobpattern-options:~:text=dir1/%20dir2/.-,fsPromises.glob(pattern%5B%2C%20options%5D),-%23" rel="nofollow">https://nodejs.org/docs/latest-v24.x/api/fs.html#fspromisesg...</a><p>> Also there's arguably design. Should a 'glob' library actually read the file system and give you filenames or should it just tell you if a string matches a glob and leave the reset to you?<p>There's a function in Node's stdlib that does this as well (albeit it's marked as experimental): <a href="https://nodejs.org/docs/latest-v24.x/api/path.html#pathmatchesglobpath-pattern:~:text=COPY-,path.matchesGlob(path%2C%20pattern),-%23" rel="nofollow">https://nodejs.org/docs/latest-v24.x/api/path.html#pathmatch...</a></p>
]]></description><pubDate>Sat, 10 May 2025 19:38:32 +0000</pubDate><link>https://news.ycombinator.com/item?id=43948276</link><dc:creator>throwitaway1123</dc:creator><comments>https://news.ycombinator.com/item?id=43948276</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=43948276</guid></item></channel></rss>