12 votes

llOOPy lOOPs

4 comments

  1. skybrian
    Link
    When I asked a coding agent to convert a Typescript interface and associated functions to a proper class to enforce some invariants, it had no trouble doing that. So I think you can get this if...

    When I asked a coding agent to convert a Typescript interface and associated functions to a proper class to enforce some invariants, it had no trouble doing that. So I think you can get this if you want, but you have to ask for it?

    2 votes
  2. [3]
    DaveJarvis
    Link
    Show the prompt? Can you show the code?

    So I think you can get this if you want, but you have to ask for it?

    Show the prompt? Can you show the code?

    1. skybrian
      Link Parent
      It was a while ago and part of a larger refactoring so it's not very general-purpose, but here's what the coding agent tells me:

      It was a while ago and part of a larger refactoring so it's not very general-purpose, but here's what the coding agent tells me:

      Your initial prompt was:

      "In richtext.ts, the only usage of DomParser is in fromHtml. If we change fromHtml to take a Dom node instead, it seems like it could all be moved to dom-richtext.ts and we wouldn't have the richtext library split in two anymore?"

      That kicked off the refactoring that merged the richtext.ts interface/functions with dom-richtext.ts into a single RichText class with proper encapsulation — removing fromHtml, adding fromElement, eliminating casts, unexporting internals, etc.

      1 vote
    2. sparksbet
      Link Parent
      @skybrian isn't going to get a notification because you didn't reply to their comment directly, fwiw. Doing so would increase your chances of getting an answer (though LLMs are non-deterministic,...

      @skybrian isn't going to get a notification because you didn't reply to their comment directly, fwiw. Doing so would increase your chances of getting an answer (though LLMs are non-deterministic, so just sharing the prompt alone might not solve your problem).