Talk About Network

Google


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 > Languages Misc > Re: ANN: Seed7 ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 9 of 18 Topic 1109 of 1217
Post > Topic >>

Re: ANN: Seed7 Release 2008-02-17

by "Bartc" <bc@[EMAIL PROTECTED] > Feb 19, 2008 at 11:43 PM

thomas.mertes@[EMAIL PROTECTED]
 wrote:
> On 18 Feb., 22:02, Bart <b...@[EMAIL PROTECTED]
> wrote:
>> On Feb 17, 10:13 pm, thomas.mer...@[EMAIL PROTECTED]
 wrote:
>>
>> [From Seed 7 FAQ]
>>
>>> Variables with object types contain references to object values....
>>> a := b
>>> For primitive types a different logic is used...
>>> a := b
>>> both variables are still distinct and changing one variable has no
>>> effect on the other.
>>
>> This is more of a general question about a:=b for a class object
>> being different from a:=b for an ordinary object. It seems to be the
>> case in several oo languages.
>>
>> Why?
> IMHO it is a cornerstone of classic OO programming languages
> like Smalltalk and its descendants: Object variables and
> parameters contain just pointers to the actual object value
> which is at the heap. It is almost not mentioned by OO
> proponents but in classic OO programming not everything is
> done with methods. Assignments are always done as pointer
> assignments, independend of the object class. Also comparisons
> are done as pointer comparisons. Therefore a 'clone' method
> to do deep copies and an 'compare' method to do logical
> comparisons is necessary.
>
> The advantage of this OO pointer philosophy is that container
> cl***** are easier to implement (they store just pointers in
> the container).
>
>> OK, objects are implemented by reference and all that, and maybe this
>> saves some copying, but that should all be transparent.
>>
>> Surely the meaning of something as basic as a:=b should not depend on
>> something as arbitrary as whether a and b have datatypes T or U. If
>> someone changes their mind then a lot of recoding might be needed!
>
> Most OO programmers have the different assignment logic for
> object variables in their mind. They would be confused when
> those assignments would work as deep copies (As Seed7 does
> for all other types).
>
> IIRC Simula had two different assignment operators:
>  := For value copy assignments
>  :- For reference assignments
>
> Seed7 is an extensible programming language.
> It would be possible to define the assignment to do a (deep)
> copy of the implementation (object) value and to have
> a different operator to do reference assignment.
>
> I don't belive that OO fan's would be happy without
> reference assignment?
>
> What do you think?

I think it's a bit late to change things now.

I suppose I just have to think about objects as pointers instead, with 
whatever they're pointing to being automatically managed:

ptrA := ptrB    ( programming equivalent of training wheels :-)

--
Bart
 




 18 Posts in Topic:
ANN: Seed7 Release 2008-02-17
thomas.mertes@[EMAIL PROT  2008-02-17 14:13:00 
Re: Seed7 Release 2008-02-17
"Aaron Gray" &l  2008-02-18 09:41:13 
Re: Seed7 Release 2008-02-17
"Aaron Gray" &l  2008-02-18 16:42:21 
Re: Seed7 Release 2008-02-17
thomas.mertes@[EMAIL PROT  2008-02-18 06:09:03 
Re: Seed7 Release 2008-02-17
thomas.mertes@[EMAIL PROT  2008-02-18 10:43:00 
Re: Seed7 Release 2008-02-17
"Aaron Gray" &l  2008-02-18 23:19:32 
Re: ANN: Seed7 Release 2008-02-17
Bart <bc@[EMAIL PROTEC  2008-02-18 13:02:28 
Re: ANN: Seed7 Release 2008-02-17
thomas.mertes@[EMAIL PROT  2008-02-19 13:51:04 
Re: ANN: Seed7 Release 2008-02-17
"Bartc" <bc@  2008-02-19 23:43:10 
Re: ANN: Seed7 Release 2008-02-17
"Captain Tony Valare  2008-03-26 17:39:27 
Re: ANN: Seed7 Release 2008-02-17
"Captain Tony Valare  2008-03-26 19:57:13 
Re: ANN: Seed7 Release 2008-02-17
Richard Heathfield <rj  2008-03-27 06:41:43 
Re: ANN: Seed7 Release 2008-02-17
cri@[EMAIL PROTECTED] (R  2008-03-27 08:04:53 
Re: ANN: Seed7 Release 2008-02-17
"Captain Tony Valare  2008-03-27 14:37:00 
Re: ANN: Seed7 Release 2008-02-17
Richard Heathfield <rj  2008-03-27 19:57:35 
Re: ANN: Seed7 Release 2008-02-17
"Captain Tony Valare  2008-03-27 16:04:09 
Re: ANN: Seed7 Release 2008-02-17
Richard Heathfield <rj  2008-03-27 21:36:52 
Re: ANN: Seed7 Release 2008-02-17
"Captain Tony Valare  2008-03-27 19:09:23 

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 Jul 25 23:46:05 CDT 2008.