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 2 of 2 Topic 2820 of 2842
Post > Topic >>

Re: Combining mutable objects with const references

by torbenm@[EMAIL PROTECTED] (Torben =?iso-8859-1?Q?=C6gidius?= Mogense Apr 23, 2008 at 05:59 PM

Joachim Durchholz <jo@[EMAIL PROTECTED]
> writes:

> Am Mittwoch, den 23.04.2008, 06:12 -0700 schrieb
> anonposting@[EMAIL PROTECTED]
>> There are times when this would restrict the programmer (for example,
>> if a circularly-linked list was desired), but this special usage
>> should be made distinct. Or at least, that's what I'm suggesting.
>
> That depends.
> If efficiency is your goal, then you're probably right. But then you
> probably should be coding in assembly.
> If maintainability is your goal, then you're probably not right. Imagine
> the situation when specifications change, and the program needs to
> retain a data structure. This change could be quite pervasive, affecting
> most of the program (e.g. a new requirement that specific intermediate
> steps need to be logged for later analysis). This could very well affect
> a multitude of places in the program.
> In the end, it's probably easier to leave it to the compiler to analyze
> what data may be overwritten and what needs to be retained. This kind of
> analysis is error-prone, i.e. it takes up a lot of maintenance and
> debugging time with no guarantee that you get it right; better to leave
> it to the compiler who may miss some opportinities but also miss all
> mistakes that a human would make.

When significant performance differences rest on the precision of an
analysis, which can be the case for the above, I prefer to get some
feedback from the compiler about whether it is able to do the
optimisation or not.  So, I prefer an annotation that tells the
compiler to try to reuse the object, but give a warning if it cannot
do so.  It could still compile the program (and not reuse the object,
which is safe), but the developer will know that he might have to
rewrite the program to gain the desired performance.

	Torben




 2 Posts in Topic:
Re: Combining mutable objects with const references
Joachim Durchholz <jo@  2008-04-23 17:24:59 
Re: Combining mutable objects with const references
torbenm@[EMAIL PROTECTED]  2008-04-23 17:59:29 

Post A Reply:
  Go here to Signup

AddThis Feed Button


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

Contact
tan12V112 Sat May 17 8:40:27 CDT 2008.