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 5 of 16 Topic 2817 of 2841
Post > Topic >>

Re: Combining mutable objects with const references

by torbenm@[EMAIL PROTECTED] (Torben =?iso-8859-1?Q?=C6gidius?= Mogense Apr 24, 2008 at 09:35 AM

anonposting@[EMAIL PROTECTED]
 writes:

> On Apr 23, 4:24 pm, Joachim Durchholz <j...@[EMAIL PROTECTED]
> wrote:
>
>> 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.
>
> The kind of object use I am refering to is not optimization. Suppose
> my object is a car in a game and its position (my point p) changes
> every time the game engine calculates a new position for the car. Of
> course we would not create a new car object every twenty milliseconds.
> Every time an imperative programmer destructively updates an object,
> he is using an object whose previous values he knows he will not have
> to refer to later. So these types of object are very common.

Modern games do not modify selecetd parts of the picture on the screen
but instead create a new picture every frame.  So it would only be
natural to create a new "scene" in memory and display that instead of
destructively updating the old scene.  This will also allow for
rewinding or replaying parts of a game (as some games allow).  If a
large part of the scene is shared between frames, this doesn't have to
take enormous amounts of memory.

Where you do not need to rewind or restore, destructive updating can
be seen as an optimisation, but by using almost identical programming
constructs (differing only in type or small annotations) for creating
new objects and destructively updating old objects, it will be a lot
easier to add rewind facilities afterwards.

	Torben




 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 Thu May 15 20:56:09 CDT 2008.