[personal profile] sassa_nf
ok, here's what was wrong with the previous attempt: https://stackoverflow.com/a/59576677/1935631

Declaring something as a mutable reference seems to imply that the receiver of it is the sole owner, but it doesn't work for struct fields and return values.

The expression problem - use Box. Box can be declared to contain some implementation of a trait, then at construction time you tell what that implementation is. Also, you can even add the lifetime to the signature.

Then also a closure with a reference to an immutable field - well, it used to capture a mutable reference self, not self.mx. But if you create a local variable first, then you can move that.

Date: 2020-01-03 04:19 pm (UTC)
juan_gandhi: (Default)
From: [personal profile] juan_gandhi
So, maybe it's a hit that we have to view it as a sign to start treating iterators differently.

Date: 2020-01-04 01:54 am (UTC)
juan_gandhi: (Default)
From: [personal profile] juan_gandhi
Well, I'm totally confused how to combine these dimensions in a reasonable discourse.

Date: 2020-01-04 03:51 pm (UTC)
juan_gandhi: (Default)
From: [personal profile] juan_gandhi
I'm a little bit confused with this python code, but it's not the point.

My point is, I'm afraid Rust has "progressed" from a pure linear-logic language to something slightly c-ish, to satisfy the consumer. I have a feeling that I do not want to use `Box`, `dyn` and the like; not even sure about lifetimes.

I'd like to find a solution that satisfies the very basic ideas of the language. And I think, for instance, that the idea of exposing an iterator, or a generator, is not how the language was designed. Creating something inside some function and then returning it, it does not seem like a good idea in Rust. If we can live without a comonad... can we? I don't know.

Date: 2020-01-04 05:08 pm (UTC)
juan_gandhi: (Default)
From: [personal profile] juan_gandhi
Well, yes; weird.

Date: 2020-01-04 09:32 pm (UTC)
juan_gandhi: (Default)
From: [personal profile] juan_gandhi
Thanks for pointing out. Maybe life can be a bit easier with this.

Profile

sassa_nf

January 2026

S M T W T F S
    123
45678910
111213141516 17
18192021222324
25262728293031

Style Credit

Expand Cut Tags

No cut tags
Page generated Jan. 21st, 2026 01:32 am
Powered by Dreamwidth Studios