Article View: comp.arch
Article #48Re: Rust
From: Stefan Monnier
Date: Sun, 11 Oct 2026 18:26
Date: Sun, 11 Oct 2026 18:26
13 lines
2125 bytes
2125 bytes
> Which leads to the question? Can an experienced Rust programmer do a > search that works like the C search(), and an insert that calls > search() and then uses the reference to either update a node or insert > a new one? IIUC it can but at the cost of making `search` take a `&mut` reference. I get the impression that you'd otherwise need "mutability polymorphism", i.e. a single piece of code that can be instantiated either for `&` or for `&mut`. You can probably avoid writing the code twice, tho, by abusing macros (aka "template polymorphism"). === Stefan
Technical Details
Message-ID:
<jwvcxtg9jxl.fsf-monnier+comp.arch@gnu.org>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mailReferences:
<1177fdi$26ea4$1@dont-email.me> <2026Oct6.102919@mips.complang.tuwien.ac.at> <11a6326$qkk$1@reader2.panix.com> <2026Oct10.161800@mips.complang.tuwien.ac.at> <11adson$sir$1@reader2.panix.com> <2026Oct11.174012@mips.complang.tuwien.ac.at>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail From: Stefan Monnier <monnier@iro.umontreal.ca> Newsgroups: comp.arch,comp.programming Subject: Re: Rust Date: Sun, 11 Oct 2026 14:26:48 -0400 Organization: A noiseless patient Spider Lines: 13 Message-ID: <jwvcxtg9jxl.fsf-monnier+comp.arch@gnu.org> References: <1177fdi$26ea4$1@dont-email.me> <2026Oct6.102919@mips.complang.tuwien.ac.at> <11a6326$qkk$1@reader2.panix.com> <2026Oct10.161800@mips.complang.tuwien.ac.at> <11adson$sir$1@reader2.panix.com> <2026Oct11.174012@mips.complang.tuwien.ac.at> MIME-Version: 1.0 Content-Type: text/plain Injection-Date: Mon, 12 Oct 2026 06:13:21 +0000 (UTC) Injection-Info: dont-email.me; logging-data="3495182"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1948FMeFDwTqZQjNrvkUz/VUUbZl4gGkTE="; posting-host="e1f297d5d3b971fefde5c4023907b158" User-Agent: Gnus/5.13 (Gnus v5.13) Cancel-Lock: sha1:JLdhsw9rDOsbnb/iBK2SwmGNmnw= sha1:vM7MEpM/pbnFzLXUUQVq3VcFSac= sha256:WRX9kyVXpYbjAGeERhrxuEpkYMoLr9Hh4M6V89PNpIc= sha1:dz1IyD4obYwnYV+/2eIfsFjZhy8= sha256:93hL94DZAN69Qpkyp4zD6LFG9zPJ6k9E1GnZCf2RIX8= In-Reply-To: <2026Oct11.174012@mips.complang.tuwien.ac.at> (message from anton@mips.complang.tuwien.ac.at (Anton Ertl) on Sun, 11 Oct 2026 15:40:12 GMT)