🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.programming
Article #9

Re: Rust

#9
From: Dan Cross
Date: Mon, 12 Oct 2026 19:14
17 lines
1668 bytes
In article <jwvcxtg9jxl.fsf-monnier+comp.arch@gnu.org>,
Stefan Monnier  <monnier@iro.umontreal.ca> wrote:
>> 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").

...or using interior mutability with e.g., a `Cell`.

	- Dan C.
Technical Details
Message-ID: <11ajbi6$j2c$1@reader2.panix.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!panix!.POSTED.spitfire.i.gajendra.net!not-for-mail
References: <1177fdi$26ea4$1@dont-email.me> <11adson$sir$1@reader2.panix.com> <2026Oct11.174012@mips.complang.tuwien.ac.at> <jwvcxtg9jxl.fsf-monnier+comp.arch@gnu.org>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!panix!.POSTED.spitfire.i.gajendra.net!not-for-mail
From: cross@spitfire.i.gajendra.net (Dan Cross)
Newsgroups: comp.arch,comp.programming
Subject: Re: Rust
Date: Mon, 12 Oct 2026 19:14:14 -0000 (UTC)
Organization: PANIX Public Access Internet and UNIX, NYC
Message-ID: <11ajbi6$j2c$1@reader2.panix.com>
References: <1177fdi$26ea4$1@dont-email.me> <11adson$sir$1@reader2.panix.com> <2026Oct11.174012@mips.complang.tuwien.ac.at> <jwvcxtg9jxl.fsf-monnier+comp.arch@gnu.org>
Injection-Date: Mon, 12 Oct 2026 19:14:14 -0000 (UTC)
Injection-Info: reader2.panix.com; posting-host="spitfire.i.gajendra.net:166.84.136.80";
	logging-data="19532"; mail-complaints-to="abuse@panix.com"
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: cross@spitfire.i.gajendra.net (Dan Cross)