Elektrine lite

← Feed

@jana@fedi.xirion.net

Post #3192756

2026-03-27 11:46 UTC

@guenther@chaos.social @terts@mastodon.online good question. Our best explanation is that because the binding is not yet initialized it just creates three separate bindings, not caring about copying or cloning or whatever since there's no data to copy or clone. Note that a let binding can be a pattern, so the `@ c` is just a pattern matching You just get `c: Foo`, `a: T` and `b: i32`. Now the binding van be used separately, and assignments to each don't affect the other. However, type inference does go through this. Both c.a and a have type T and so `Default` works because we assign a string to the a field of Foo

Replies (1)

  • @guenther@chaos.social 2026-03-27 12:27

    @jana@fedi.xirion.net @terts@mastodon.online So basically, you can give `let` some random pattern, it'll create a variable for every name in that pattern, and also use the pattern for type inference, but since there is no assignment going on there, you'll have to initialize all these variables later, separately?

    Open ##3192757