Native Differential Programming Support for Rust

Yes, using Mul for something like the Hadamard product (or the Kronecker product!) is really silly, but I think bikeshedding the surface syntax of something built on the intrinsic in question feels very irrelevant. We should probably grow the relevant attr or core::arch item or whatever before getting bogged down in non-blocking details.

1 Like

I don’t suppose Rust has ever considered adding e.g. the @ multiplication operator from python. I’ve seen haskell-esque infix backtick operators (a `mod` b) discussed.

I’m actually an appropriate person to ask this of, since in my early days of Rust I explored a similar question. Read the reference, then answer the question: What percentage of the alphanumeric multiply operator method calls in a large corpus of code would be replaced by use of a glyph operator?

I’ll let others respond about Rust’s history of use of the @ sigil, and point out where in Rust’s grammar it still occurs.

Pattern matching, e.g. let x@[_, _] = [1, 2]. This is a special case of the “intersection pattern” in F#.

Guess I’ll do it myself. Per the Wikipedia entry about Rust,

Hi @karanchahal,

There is few project already out there, just to name a few

I would properly argue that this should start by living in a crate. the only reason I could see this move into Rust std/core is if there is going to some llvm intrinsic.

There is still a lot of research going on so it’s properly for the best to be in a crate till things have settle.


There is still a lot of research going on so it’s properly for the best to be in a crate till things have settle.

Exactly! Automatic differentiation is still a research subject and has only very targeted applications : it is the opposite of something we would want to freeze in a language’s core implementation.

Plus we are lucky to have a macro system that should be powerful enough to emulate what other languages do with native support.


Counting notebook code… enough that python adding the @ was quite nice. Not counting notebooks very very little. Admittedly I don’t really use a notebook workflow for Rust.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.