Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Functional > Re: Combining m...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 16 of 16 Topic 2817 of 2841
Post > Topic >>

Re: Combining mutable objects with const references

by rossberg@[EMAIL PROTECTED] Apr 26, 2008 at 10:04 AM

On Apr 26, 3:07=A0pm, anonpost...@[EMAIL PROTECTED]
 wrote:
> Oh, no I think I understand you now, rossb. You're saying that
> mutability is dangerous *unless* we make it safe with the appropriate
> compiler rules. But that's the whole point of the thread! ...I don't
> think I've misunderstood you. You say it wouldn't be trivial to
> implement this. That doesn't necessarily mean it isn't a good feature
> to have.

Well, "implementing" it is not the biggest problem. It also is more
difficult to use. Substructural components like linearity complicate a
type system severely, and every programmer must understand and write
more complicated types. Unless you don't care about modularity it's
not just a compiler-internal analysis, it fundamentally changes the
look and feel of a language.

That's not to say that it isn't cool, but there is a heavy trade-off.
A cheaper approach like Haskell's state monad, which achieves
something similar but is more restrictive, might be the easier choice.

So in brief, what you suggest can be done, but not directly or for
free. You need to extend the language, and the programmer must use
these extensions to benefit from it. Haskell and Clean show two
different ways of doing that for a practical language. More powerful
(but yet more complicated) approaches can be found in some
experimental languages.

- Andreas




 16 Posts in Topic:
Combining mutable objects with const references
anonposting@[EMAIL PROTEC  2008-04-22 07:32:52 
Re: Combining mutable objects with const references
=?ISO-8859-1?Q?Pertti_Kel  2008-04-22 23:23:43 
Re: Combining mutable objects with const references
anonposting@[EMAIL PROTEC  2008-04-23 06:12:53 
Re: Combining mutable objects with const references
anonposting@[EMAIL PROTEC  2008-04-23 14:05:57 
Re: Combining mutable objects with const references
torbenm@[EMAIL PROTECTED]  2008-04-24 09:35:17 
Re: Combining mutable objects with const references
=?ISO-8859-1?Q?Matti_Nyk=  2008-04-24 09:46:58 
Re: Combining mutable objects with const references
anonposting@[EMAIL PROTEC  2008-04-24 10:36:38 
Re: Combining mutable objects with const references
Paul Rubin <http://phr  2008-04-24 11:39:31 
Re: Combining mutable objects with const references
anonposting@[EMAIL PROTEC  2008-04-24 14:13:19 
Re: Combining mutable objects with const references
Paul Rubin <http://phr  2008-04-24 19:04:30 
Re: Combining mutable objects with const references
anonposting@[EMAIL PROTEC  2008-04-25 04:13:13 
Re: Combining mutable objects with const references
rossberg@[EMAIL PROTECTED  2008-04-25 06:57:19 
Re: Combining mutable objects with const references
Paul Rubin <http://phr  2008-04-25 09:42:29 
Re: Combining mutable objects with const references
anonposting@[EMAIL PROTEC  2008-04-26 05:38:40 
Re: Combining mutable objects with const references
anonposting@[EMAIL PROTEC  2008-04-26 06:07:26 
Re: Combining mutable objects with const references
rossberg@[EMAIL PROTECTED  2008-04-26 10:04:14 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri May 16 0:15:09 CDT 2008.