jzarnett / ece459

ECE 459: Programming for Performance
419 stars 133 forks source link

Make fn var argument mutable typo fix #63

Closed NathanielRN closed 3 years ago

NathanielRN commented 3 years ago

As mentioned in Lecture 18 @ 12:50 the y value (and I'm assuming the z value?) need to be mutable mut in the function signature.

bkthomps commented 3 years ago

@jzarnett merge?

jzarnett commented 3 years ago

So I looked at this but the original version without the mut added to x and y still compiles. The new declarations of let x =... and let y = ... are an example of shadowing. So they don't have to be mutable for the example to compile and run.

Now, I didn't watch the video segment again before writing this, so maybe there's something else in the video referencing the variables that means it makes sense for them to be mut?

bkthomps commented 3 years ago

@NathanielRN

NathanielRN commented 3 years ago

I'll close this since you said it works! Although I would say that's it's confusing to use the same value as the function argument variable even if it works with shadowing...

bkthomps commented 3 years ago

I would say shadowing is fine, but putting three variable declarations on the same line isn't great.