<oembed><type>rich</type><version>1.0</version><title>Rusty Russell wrote</title><author_name>Rusty Russell (npub179…elz4s)</author_name><author_url>https://yabu.me/npub179e9tp4yqtqx4myp35283fz64gxuzmr6n3yxnktux5pnd5t03eps0elz4s</author_url><provider_name>njump</provider_name><provider_url>https://yabu.me</provider_url><html>Since I&#39;m taking a few weeks vacation, I&#39;ve decided to seriously try to learn rust. My method in this case is to ask ChatGPT to guide me (but not write for me!) a library (&#34;crate&#34;) that I&#39;ve always wanted to write and never got around to. &#xA;&#xA;Of course, I get a lot of feedback on appropriate rust styling, but some of it veers into things I feel are deeper constraints. In this case, I had an open function, which took a struct containing some flags, such as &#34;writeable&#34;, &#34;create if didn&#39;t exist&#34;.&#xA;&#xA;It didn&#39;t like the fact that I asserted if you set create and didn&#39;t set writeable. Here is my response: &#xA;&#xA;---&#xA;&#xA;Re: assert!().  I dislike APIs which allow misuse.  Callers of a library should not rely on such checks in the library, in fact the concept of adding an InvalidOptions error type is offensive.  A recoverable error is strictly a worse api than an unignorable error.  But a compile time error is better.&#xA;&#xA;We should use an enum READONLY, WRITE_MUST_EXIST, WRITE_MAY_CREATE.&#xA;&#xA;---&#xA;&#xA;Of course, it&#39;s a waste of time for me to lecture it on style, but I can&#39;t help myself!! </html></oembed>