My superficial understanding of variables in f# suggests that declaring a variable to be 'mutable' and using a 'ref' variable essentially both do the same thing. They are both different ways to address the same underlying issue - a limited and structured allowance of mutability in a functional language without having to resort to the IO Monad. That there is a technical different has been 'abstracted' by my understanding.
I'm sorry if this is a multi-parter, but they all seem related.
See
http://lorgonblog.wordpress.com/2008/11/12/on-lambdas-capture-and-mutability/
especially the "language design commentary" section (I'd quote it here, but it doesn't stand alone well, you need the whole blog entry for context).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With