How would you expect a dynamic array deep copy to be named?

A small question as a small break from the XE2 news ;-)

How would you expect a dynamic array deep copy to be named?

To keep things in context, Copy() in Delphi only does shallow copy.

You would expect it to be name DeepCopy? Clone? Something else?
How is it named in other languages you know?

Eric
0
Eric
8/3/2011 1:01:16 PM
embarcadero.delphi.non-tech 5933 articles. 1 followers. Follow

35 Replies
629 Views

Similar Articles

[PageSpeed] 29

On 2011-08-03 09:01:16, Eric Grange wrote:

> How would you expect a dynamic array deep copy to be named?

Clone();
0
Anthony
8/3/2011 1:14:16 PM
On 08/03/2011 20:01, Eric Grange wrote:

> How would you expect a dynamic array deep copy to be named?
>
> To keep things in context, Copy() in Delphi only does shallow copy.
>
> You would expect it to be name DeepCopy? Clone? Something else?
> How is it named in other languages you know?

I expect it to be name DeepCopy. For other language reference, Python 
use deepcopy also.

-Jaimy.
0
Jaimy
8/3/2011 1:29:28 PM
On 2011-08-03 09:14:16 -0400, Anthony Frazier <afrazier AT victorptg 
DOT com> said:

> On 2011-08-03 09:01:16, Eric Grange wrote:
> 
>> How would you expect a dynamic array deep copy to be named?
> 
> Clone();

+1.  Less ambiguous than "Deep".  Clone has a well-understood meaning 
even outside of programming, making it easy to interpret its function 
without having to look into a manual for clarification.

--
Kevin Powick
0
Kevin
8/3/2011 2:03:35 PM
Eric Grange wrote:

> A small question as a small break from the XE2 news ;-)
> 
> How would you expect a dynamic array deep copy to be named?

DeepCopy(). Sheesh!


-- 
Rudy Velthuis

Goebel's Observation On Utopia: If everyone believed in Peace 
they would immediately begin fighting over the best way to 
achieve it.
0
Rudy
8/3/2011 2:45:02 PM
Kevin Powick wrote:

> On 2011-08-03 09:14:16 -0400, Anthony Frazier <afrazier AT victorptg 
> DOT com> said:
> 
> > On 2011-08-03 09:01:16, Eric Grange wrote:
> > 
> >> How would you expect a dynamic array deep copy to be named?
> > 
> > Clone();
> 
> +1.  Less ambiguous than "Deep".  Clone has a well-understood meaning 
> even outside of programming, making it easy to interpret its function 
> without having to look into a manual for clarification.

No it hasn't. Is all memory of all pointers in a structured type newly
alloced and the contents copied? How deep is a deep copy? If the
pointers point to structs that contain pointers to structs that contain
pointers to structs, is all that copied?

Say, you have an array of TAttributedString, and an AtributedString
contains a pointer to text as well as a dynamic arary of objects that
each point into that text and define length, text colour, background
colour, font family and font height of each of the parts of the text.
How should a copier  know how to copy that? Only TAttributedString
knows, and that would mean that TAttributedString should have a clone
method. If it doesn't, an external routine that knows nothing about
TAttributedString can't properly do a deep copy. You could say: only
copy the references to items in the array, but that would not be right.

IOW, no, clone does not have a well-understood meaning at all. It is
what the item to be cloned defines it to be.

-- 
Rudy Velthuis

"Let us change our traditional attitude to the construction of
 programs. Instead of imagining that our main task is to
 instruct a computer what to do, let us concentrate rather on
 explaining to human beings what we want a computer to do." 
 -- Donald Knuth
0
Rudy
8/3/2011 4:37:53 PM
On 2011-08-03 12:37:53 -0400, Rudy Velthuis (TeamB) 
<newsgroups@rvelthuis.de> said:

> No it hasn't.

Ok, you're right.

> How deep is a deep copy?

I don't know. How high is up? I thought you were talking about clone, not deep.

> IOW, no, clone does not have a well-understood meaning at all. It is
> what the item to be cloned defines it to be.

You mean like how read, write, refresh, update, open, close, etc. are 
all defined by the item that implements it?  No kidding.

The question was for a preference between Clone vs DeepCopy as a method 
name.  Since our interpretation of the meaning of those words is based 
upon the sum of our individual experiences, I expressed my opinion that 
Clone was a better, less ambiguous word than DeepCopy.  Though, I 
didn't think I would have to explain that it was an opinion, nor the 
factors involved that influence one's opinion.

So, I guess we can take it that the sum total of your personal 
experiences leaves you with the valid *opinion*, yet no more valid than 
my opinion, that Clone is not a word you understand to have a certain 
or specific meaning, in the context of Eric's question.

--
Kevin Powick
0
Kevin
8/3/2011 6:16:59 PM
On 2011-08-03 12:37:53, Rudy Velthuis (TeamB) wrote:

> IOW, no, clone does not have a well-understood meaning at all. It is
> what the item to be cloned defines it to be.

I'd say it's no better or worse than Copy() is.  You're only used to
Copy() doing shallow clones because that's what it's always done.

Considering who the OP is, I'm assuming that it's intended to be part
of DWScript.  If my assumption is correct (yeah, yeah, I know :-) ),
then DWScript's object-oriented and pointer-free base mean that all
your concerns go out the window -- it's entirely possible to do a deep
copy of an object.

Alternatives include: 
* Make Copy() into ShallowCopy()
* Overload Copy() with a parameter to indicate that a deep copy should
be done
0
Anthony
8/3/2011 6:33:28 PM
Anthony Frazier wrote:

> On 2011-08-03 12:37:53, Rudy Velthuis (TeamB) wrote:
> 
> > IOW, no, clone does not have a well-understood meaning at all. It is
> > what the item to be cloned defines it to be.
> 
> I'd say it's no better or worse than Copy() is. 

Copy() copies one level of a dynarray (or actually, a dynarray always
has only one level). Ir does not try to do a "deep copy", or a "clone",
since what these are is depends on the data.

-- 
Rudy Velthuis

"It's the liberal bias. The press is liberally biased to the 
 right." -- Ken de Camargo
0
Rudy
8/3/2011 7:07:52 PM
Kevin Powick wrote:

> On 2011-08-03 12:37:53 -0400, Rudy Velthuis (TeamB) 
> <newsgroups@rvelthuis.de> said:
> 
> > No it hasn't.
> 
> Ok, you're right.
> 
> > How deep is a deep copy?
> 
> I don't know. How high is up? I thought you were talking about clone,
> not deep.
> 
> > IOW, no, clone does not have a well-understood meaning at all. It is
> > what the item to be cloned defines it to be.
> 
> You mean like how read, write, refresh, update, open, close, etc. are 
> all defined by the item that implements it?  No kidding.
> 
> The question was for a preference between Clone vs DeepCopy as a
> method name.  

Well something that does a deep copy should be called DeepCopy, IMO. 
-- 
Rudy Velthuis

"I have not failed. I've just found 10,000 ways that won't work."
 -- Thomas Alva Edison (1847-1931)
0
Rudy
8/3/2011 7:08:35 PM
Eric Grange wrote:
> A small question as a small break from the XE2 news ;-)
> 
> How would you expect a dynamic array deep copy to be named?
> 
> To keep things in context, Copy() in Delphi only does shallow copy.
> 
> You would expect it to be name DeepCopy? Clone? Something else?
> How is it named in other languages you know?

I'd probably vote for DeepCopy: it keeps the semantics of Copy, adding 
just a "fixed option" to it.
0
Jouni
8/3/2011 8:09:46 PM
Am 03.08.2011 22:09, schrieb Jouni Aro:
> Eric Grange wrote:
>> A small question as a small break from the XE2 news ;-)
>>
>> How would you expect a dynamic array deep copy to be named?
>>
>> To keep things in context, Copy() in Delphi only does shallow copy.
>>
>> You would expect it to be name DeepCopy? Clone? Something else?
>> How is it named in other languages you know?
> 
> I'd probably vote for DeepCopy: it keeps the semantics of Copy, adding 
> just a "fixed option" to it.

Me too but another sugestion could be StructuredCopy.

Greetings

Markus
0
Markus
8/3/2011 9:00:10 PM
Rudy Velthuis (TeamB) wrote:

> Well something that does a deep copy should be called DeepCopy, IMO. 

But the point it, it depends on what you mean by "deep copy".

-- 
SteveT
0
Steve
8/3/2011 9:12:21 PM
Steve Thackery wrote:

> Rudy Velthuis (TeamB) wrote:
> 
> > Well something that does a deep copy should be called DeepCopy,
> > IMO.
> 
> But the point it, it depends on what you mean by "deep copy".

Indeed. But I am not writing the function. <g>

-- 
Rudy Velthuis

"Devlin's First Law - Buyer beware: in the hands of a charlatan, 
 mathematics can be used to make a vacuous argument look 
 impressive.
 Devlin's Second Law - So can PowerPoint." -- Keith Devlin
0
Rudy
8/3/2011 9:41:21 PM
Eric Grange wrote:

> To keep things in context, Copy() in Delphi only does shallow copy.

Exactly what do you mean by "shallow copy" in this context? Calling
Copy(Source,Index,Count) results in a call to _DynArrayCopyRange which
allocates a new dynamic array instance and copies the contents of
Source to Result.

-- 
Posted with StreamSec Newsreader 0.9.0.5
http://newsreader.streamsec.net
0
Utf
8/3/2011 10:02:06 PM
Rudy Velthuis (TeamB) wrote:

> Copy() copies one level of a dynarray (or actually, a dynarray always
> has only one level). Ir does not try to do a "deep copy", or a
> "clone", since what these are is depends on the data.

Or does it? Pascal has two kinds of types: value types and pointer
types. When you want to operate on values, you use value types. When
you want to operate on pointers to memory locations containing values,
you use pointer types. If you got an array you want to be able to
perform a "deep copy" on, you just haven't declared the type of that
array properly. It should be an array of static arrays instead of
dynamic arrays, of records instead of objects, etc.

-- 
Posted with StreamSec Newsreader 0.9.0.5
http://newsreader.streamsec.net
0
Utf
8/3/2011 10:30:48 PM
> No it hasn't. Is all memory of all pointers in a structured type newly
> alloced and the contents copied? How deep is a deep copy?

Yes, that's another issue to consider, should the deep copy apply only 
to the (nested) dynamic arrays or extended to the leafs?

In some cases, it's trivial to clone (arrays of Integer, records that 
contain only simple value types), but as soon as an object or pointer 
gets into the mix, this means a Clone method needs to be present (or 
"forbidden", f.i. for arrays of singletons or cross-referenced objects).

Eric
0
Eric
8/4/2011 6:37:56 AM
> Exactly what do you mean by "shallow copy" in this context? Calling
> Copy(Source,Index,Count) results in a call to _DynArrayCopyRange which
> allocates a new dynamic array instance and copies the contents of
> Source to Result.

If you have an array of array, Copy will copy only the base array, the 
sub-arrays won't be copied, and the copied array will hold references to 
the same sub-arrays as the original.

Eric
0
Eric
8/4/2011 6:40:13 AM
> it's entirely possible to do a deep copy of an object.

Indeed, it's possible, but it's only circumstancially meaningful.
F.i. the objects could be leaf values, cross-referenced, and for which 
cloning is meaningless, or they could be singletons, or they could be 
wrappers for Delphi-side objects that can't be cloned, etc.

> * Overload Copy() with a parameter to indicate that a deep copy should
> be done

I'm considering a deep copy depth anyway.

Extending Copy() might be convenient though, but in a different context, 
as Copy() specifies a range of items to copy, so it means you would also 
have to specify the sub-ranges to copy.
It could make sense to extract a sub-matrix, a sub-cube, a 
sub-hypercube, etc. but wouldn't be practical for nested arrays with 
heterogeneous length (ie. trees).

Eric
0
Eric
8/4/2011 6:48:55 AM
> {quote:title=Henrick Hellström wrote:}{quote}
> Eric Grange wrote:
> 
> > To keep things in context, Copy() in Delphi only does shallow copy.
> 
> Exactly what do you mean by "shallow copy" in this context? 
>

Take a look at this: http://www.learncpp.com/cpp-tutorial/912-shallow-vs-deep-copying/
0
Jeff
8/4/2011 7:23:22 PM
Jeff Weir wrote:

> > {quote:title=Henrick Hellström wrote:}{quote}
> > Eric Grange wrote:
> > 
> > > To keep things in context, Copy() in Delphi only does shallow
> > > copy.
> > 
> > Exactly what do you mean by "shallow copy" in this context? 
> > 
> 
> Take a look at this:
> http://www.learncpp.com/cpp-tutorial/912-shallow-vs-deep-copying/

Yes, that seems to be a great post about the concept in the context of
C++ object assignments. :)

FWIW and IMHO, I think the only thing that makes the dichotomy
shallow/deep copying relevant, is whenever the difference between value
types and pointer types has been confused, e.g. when you use pointer
types where the surrounding code expects you to use value types.

-- 
Posted with StreamSec Newsreader 0.9.0.5
http://newsreader.streamsec.net
0
Utf
8/4/2011 9:53:00 PM
Henrick Hellström wrote:

> Eric Grange wrote:
> 
> > To keep things in context, Copy() in Delphi only does shallow copy.
> 
> Exactly what do you mean by "shallow copy" in this context? Calling
> Copy(Source,Index,Count) results in a call to _DynArrayCopyRange which
> allocates a new dynamic array instance and copies the contents of
> Source to Result.

Yes, but since, in effect, dynarrays are only one dimension, it copies
the contents, updating reference counts if necessary, but it does not,
for instance, copy the contents of contained dynarrays. It only copies
the array references and updates the refcounts.

-- 
Rudy Velthuis

"Before the war is ended, the war party assumes the divine right
 to denounce and silence all opposition to war as unpatriotic 
 and cowardly." -- Senator Robert M. La Follette
0
Rudy
8/4/2011 10:21:14 PM
Eric Grange wrote:

> > Exactly what do you mean by "shallow copy" in this context? Calling
> > Copy(Source,Index,Count) results in a call to _DynArrayCopyRange
> > which allocates a new dynamic array instance and copies the
> > contents of Source to Result.
> 
> If you have an array of array, Copy will copy only the base array,
> the sub-arrays won't be copied, and the copied array will hold
> references to the same sub-arrays as the original.

Indeed.

-- 
Rudy Velthuis

"Glory is fleeting, but obscurity is forever."
-- Napoleon Bonaparte (1769-1821)
0
Rudy
8/4/2011 10:23:54 PM
Rudy Velthuis (TeamB) wrote:

> Yes, but since, in effect, dynarrays are only one dimension, it copies
> the contents, updating reference counts if necessary, but it does not,
> for instance, copy the contents of contained dynarrays. It only copies
> the array references and updates the refcounts.

Yes, but my (partly rhetorical) question remains: If you want Copy to
copy the contained arrays, why would you declare them as dynarray
instead of static arrays? IMHO, if there really is a need for a "deep
copy" on nested dynarrays, it means that there exists a need to treat
dynarrays like value types (which they are not) instead of pointer
types (which they are), and if there exists such a demand, dynarrays
should have been given copy-on-write semantics like the string type.

-- 
Posted with StreamSec Newsreader 0.9.0.5
http://newsreader.streamsec.net
0
Utf
8/4/2011 11:14:07 PM
Henrick Hellström wrote:

> Rudy Velthuis (TeamB) wrote:
> 
> > Yes, but since, in effect, dynarrays are only one dimension, it
> > copies the contents, updating reference counts if necessary, but it
> > does not, for instance, copy the contents of contained dynarrays.
> > It only copies the array references and updates the refcounts.
> 
> Yes, but my (partly rhetorical) question remains: If you want Copy to
> copy the contained arrays, why would you declare them as dynarray
> instead of static arrays?

I don't understand your question. I know that many people expect

  type
    K = array of array of Integer;

to be, er, "fully" copied with Copy(). That would be a deep copy.


-- 
Rudy Velthuis

"The first half of our life is ruined by our parents and the 
 second half by our children." -- Clarence Darrow.
0
Rudy
8/5/2011 1:26:01 AM
> [...] and if there exists such a demand, dynarrays
> should have been given copy-on-write semantics like the string type.

I won't disagree that Delphi dynamic arrays are quite hybrid, mostly 
because of the SetLength() behavior, which stands halfway, while for 
everything else they're a reference type.

That said, the lack of deep copy makes dynamic arrays inconvenient for 
something as mundane as a bidimensional matrix.

Eric
0
Eric
8/5/2011 7:53:24 AM
Rudy Velthuis (TeamB) wrote:

> I don't understand your question. I know that many people expect
> 
>   type
>     K = array of array of Integer;
> 
> to be, er, "fully" copied with Copy(). That would be a deep copy.

Yes, they expect dynarrays to be a value type, which it is not.

-- 
Posted with StreamSec Newsreader 0.9.0.5
http://newsreader.streamsec.net
0
Utf
8/5/2011 9:20:15 AM
Eric Grange wrote:

> I won't disagree that Delphi dynamic arrays are quite hybrid, mostly 
> because of the SetLength() behavior, which stands halfway, while for 
> everything else they're a reference type.

Interesting, I wouldn't call SetLength on a dynarray that has more than
one reference, just like I wouldn't call ReallocMem on a pointer that
has more than one reference. What happens, exactly?


> That said, the lack of deep copy makes dynamic arrays inconvenient
> for something as mundane as a bidimensional matrix.

I think what's really missing is a syntax for a completely different
kind of type, e.g. "dynamic array of type", that has copy-on-write
semantics and hence behaves more like a value type.

-- 
Posted with StreamSec Newsreader 0.9.0.5
http://newsreader.streamsec.net
0
Utf
8/5/2011 9:31:30 AM
> Interesting, I wouldn't call SetLength on a dynarray that has more than
> one reference, just like I wouldn't call ReallocMem on a pointer that
> has more than one reference. What happens, exactly?

It creates a copy of the array (always), and resizes that copy if the 
length is different.

> I think what's really missing is a syntax for a completely different
> kind of type, e.g. "dynamic array of type", that has copy-on-write
> semantics and hence behaves more like a value type.

Indeed, and that would make much sense, the reason it wasn't done is 
that copy-on-write incurs an overhead on every write access, and dynamic 
arrays are commonly written to.
So they're kind of a low-level buffer with some specialized syntax and 
compiler support.

Just as missing is a truly reference type dynamic array, that can be 
resized and references to it still being correct (like a TList can be 
resized, without making all references to it invalid).

Eric
0
Eric
8/5/2011 9:56:13 AM
Eric Grange wrote:

> Indeed, and that would make much sense, the reason it wasn't done is 
> that copy-on-write incurs an overhead on every write access, and
> dynamic arrays are commonly written to.
> So they're kind of a low-level buffer with some specialized syntax
> and compiler support.

Absolutely, and ftr I don't argue that the existing "array of type"
that was introduced in D4 should change, but in retrospect I think
pointer arithmetics should have been introduced at the same time, and
that people should have used PByte and TBytes in the same respective
ways they use PChar and string.


> Just as missing is a truly reference type dynamic array, that can be 
> resized and references to it still being correct (like a TList can be 
> resized, without making all references to it invalid).

I think you are really asking for reference counted double indirection
pointers, ^^type, no?

-- 
Posted with StreamSec Newsreader 0.9.0.5
http://newsreader.streamsec.net
0
Utf
8/5/2011 10:19:06 AM
> I think you are really asking for reference counted double indirection
> pointers, ^^type, no?

Yes, and with compiler optimization for the double indirections (when in 
loops).

Current dynamic arrays are problematic IME as soon as they leave the 
scope of a private object field, or local procedure variable.
With copy-on-write semantics a TBytes would be as safe and 
straightforward as a String, without, it's side-effects aplenty.

Eric
0
Eric
8/5/2011 11:48:10 AM
On 3/08/2011 11:01 PM, Eric Grange wrote:
> A small question as a small break from the XE2 news ;-)
>
> How would you expect a dynamic array deep copy to be named?
>
> To keep things in context, Copy() in Delphi only does shallow copy.
>
> You would expect it to be name DeepCopy? Clone? Something else?
> How is it named in other languages you know?
>
> Eric

I always avoided using clone, as it infers 'exact' copy.

Two items within copied objects tended to not be copied exactly.

1. Unique ids (for inclusion in dictionaries or written to databases)
2. Pointers to other objects

In the case of #1, you generally want the copied objects to have a new 
ID, so your dynamic array of objects with IDs for example - are you 
generating new IDs ?

In the case of #2, pointers to other objects within the copied array, or 
deeply found within those objects will not be exact copied, however 
pointers to objects outside that structure will be.

In each case the code behind the copy is far from a cloning, but rather 
as you alternately suggest a deep copy.

For me - I create a copy, with a parameter ... recursive:boolean, or 
deep:boolean ... that way I always know it is a copy, with the parameter 
telling me how deep.

Just my 2c worth.
0
Christopher
8/5/2011 10:47:23 PM
Eric Grange wrote:

> That said, the lack of deep copy makes dynamic arrays inconvenient
> for something as mundane as a bidimensional matrix.

Inconvenient, perhaps, but it is quite easy to do the deep copy
yourself. Just Copy() each of the contained arrays in a loop.

If I'd have a type like that, I'd write a simple deep copy routine,
specific for the type.

-- 
Rudy Velthuis

"A scholar who cherishes the love of comfort is not fit to be 
 deemed a scholar." -- Lao-Tzu (570?-490? BC)
0
Rudy
8/6/2011 5:36:54 AM
> Inconvenient, perhaps, but it is quite easy to do the deep copy
> yourself. Just Copy() each of the contained arrays in a loop.

No doubt, but in the end, it just means world+dog has differently named 
deep copy implementations, which just need to be maintained and debugged 
independently (and end up re-invented time and again).

Eric
0
Eric
8/8/2011 6:48:00 AM
On 03.08.2011 20:16, Kevin Powick wrote:
> On 2011-08-03 12:37:53 -0400, Rudy Velthuis (TeamB)
> <newsgroups@rvelthuis.de>  said:
>
>> No it hasn't.
>
> Ok, you're right.
>
>> How deep is a deep copy?
>
> I don't know. How high is up? I thought you were talking about clone, not deep.
>
>> IOW, no, clone does not have a well-understood meaning at all. It is
>> what the item to be cloned defines it to be.
>
> You mean like how read, write, refresh, update, open, close, etc. are
> all defined by the item that implements it?  No kidding.
>
> The question was for a preference between Clone vs DeepCopy as a method
> name.  Since our interpretation of the meaning of those words is based
> upon the sum of our individual experiences, I expressed my opinion that
> Clone was a better, less ambiguous word than DeepCopy.  Though, I
> didn't think I would have to explain that it was an opinion, nor the
> factors involved that influence one's opinion.
>
> So, I guess we can take it that the sum total of your personal
> experiences leaves you with the valid *opinion*, yet no more valid than
> my opinion, that Clone is not a word you understand to have a certain
> or specific meaning, in the context of Eric's question.

Cloning otherwise means make an exact copy, eg. if you clone an apple 
tree, you will in 99.9% of the cases get an exact copy of your old apple 
tree (done for centuries in agriculture :-) ) and every DNA molecule is 
exact the same, and in the rest,irradiation from the sky has done a 
change and either clone is dieing, or you get a new type of apple fruits :-)

So I would think that if all structures has defined a clone routine, 
cloning the top object should deliver a new object with new structures 
with exact same content and structures.

On the other side, many components don't have any clone function, at 
best the contain assigh and assignto,  which may clone or maybe not.
0
Alf
8/8/2011 4:41:24 PM
On 03.08.2011 21:08, Rudy Velthuis (TeamB) wrote:

> Well something that does a deep copy should be called DeepCopy, IMO.

In real life cloning do a deep copy, a very deep copy, dowh to the least 
atoms :-) Eg. in apple tree formation, contrary to fertilization of the 
flower and sowing apple seeds, which is not cloned at all
0
Alf
8/8/2011 4:43:54 PM
Reply:

Similar Artilces:

problem with dynamic array of dynamic array
var a:array of array of integer; begin setlength(a,2); setlength(a[0],1); setlength(a[1],2); a[0,0]:=1; //it is ok a[0,1]:=2; //it is not ok in my understanding a[0,1]:=2 is not ok because a[0] has only one element as i declared setlength(a[0],1) so i dont understand why this code exemple is compiled and run just fine ? > {quote:title=Yossi Rozenberg wrote:}{quote} > in my understanding a[0,1]:=2 is not ok because a[0] has only one element as i declared setlength(a[0],1) so i dont understand why this code exemple is compiled and run just fine ? By default, acces...

MOVED: problem with dynamic array of dynamic array
Moved to: embarcadero.public.delphi.language.delphi.general or: https://forums.embarcadero.com/thread.jspa?threadID=57076 -- Rudy Velthuis Rudin's Law: In a crisis that forces a choice to be made among alternative courses of action, people tend to choose the worst possible course. ...

Dynamic Array Names
------=_NextPart_000_0192_01C2A061.EFE4DB20 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit I have an array that I want to generate a new hash for each item that is the first array. I want the new hashes to be named as the 1st array. Wow I am confused reading that. Example ... I am using Config::IniFiles I place all the sections from the ini file into an array. I then want a new hash for each section that contains all the values and keys for that section. Ini -=- [Kelly] machine=kluiere; username=backup; password=systems; email=x...

how to generate array name dynamically
------=_NextPart_000_00E1_01C44D10.13A60780 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable hi all, i hav a requirement wherein i hav to generate array name = dynamically durin recursive function cal how can i do this . sid -------------------------------------------------------------------------= -------------------------------------------------------- "There is nothing in a caterpillar that tells you it's going to be a = butterfly." - Anonymous ********************************************* Sidharth ...

Copy dynamic array to another
What is the fastest way (execution time) to copy the contents of a dynamic array to another dynamic array (of the same size and type), so that changes to one of them will not affect the other one? Is anything significantly faster than looping through the array? Jud wrote: > What is the fastest way (execution time) to copy the contents of a > dynamic array to another dynamic array (of the same size and type), > so that changes to one of them will not affect the other one? Is > anything significantly faster than looping through the array? That depends on what is actua...

Re: @array a copy of @names???
--001636c5bf723fc8460466906cd7 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Hello, I am a complete beginner - no programming background. I want to begin with Perl and I decided to by Randal's book "*Learning Perl*". I seem to have been progressing smoothly till when I arrived at the code below on page 65. my @names = qw/ tom fred dan betty roy /; my $result = &which_element_is("dan" @names); sub which_element_is { my($what, @array) = @_; foreach (0..$#array) { if ($what eq $array[$_]) { ...

Re: How do you dynamically assign array names?
> Hi, > > I am trying to initialize a dynamically-named array, i.e. with the > following test code (if I type "script.pl char" at the command prompt) I > get the message "array char contains 1 2 3" but I get a warning if 'use > strict' is on. Can anyone show me how it should be done (I would like to > use 'use strict'!)? > > #!/usr/bin/perl -w > #use strict; > my ($string); > > while (<$ARGV[0]>) { > chomp($string=$_); > @$string = (1,2,3); #Won't work if 'use strict' pr...

Non-tech with a file copy question
Can I just simply copy or backup/restore my GW55 email/calendar/etc. files to another server if my original server crashed or I'm changing to a new server? I assume I would need to unload GW, but which files would I copy? Thanks. explain. you mean the whole PO or what. elucidate. -- Michael J. Bell Novell Support Connection Volunteer Sysop Author of Guinevere (http://www.openhandhome.com) PLEASE: Do not e-mail me privately unless specifically asked. I'm a volunteer, not a Novell employee! All opinions and advice provided are MINE alone and NOT Novell&...

Dynamic Arrays / Static Arrays
If I call SetLength on a dynamic array, does it become more or less a static array? In use is there much difference between a dynamic and a static array? The reason I ask is becaue I don't seem to have had much use for dynamic arrays in what I've created in the past but due to a change of approach in one program I now need to declare an array without knowing how many elements it will have. In the previous incarnation I always knew in advance that the array would have 15 elements. I don't know why I've not had to ask this question before, but as usual, when I do have to...

Copy and Paste not working as expected in Delphi XE2
Hey guys, This should be simple and I must be missing something: In Delphi's IDE, if I copy something (say "MyVar") and I paste it on a selected text (say "MyOldVar") then "MyVar" does not replace "MyOldVar"; instead, it is pasted right of it. This must be a configuration issue but I can't seem to locate the switch or the command I need to hit to get Delphi to behave in the way I described: have the pasted text replace the selected text. Your help, suggestion is greatly appreciated. Thanks Naji wrote: > In Delphi's IDE, if...

Shalow copy and deep copy
what is hte difference between shallow copy & deep copy? In a shallow copy any objects referenced by the object being copied are not copied. In a deep copy, objects referenced by the object being copied are also copied. imagine object A that has a property set to point to object B A -> B now we do a shallow copy A1 -> B A and A1 both share the same instance of object B If we instead had done a deep copy then we'd get A1 -> B1    Mike Banavige~~~~~~~~~~~~Need a site code sample in a different language? Try converting it with: http://converter.teler...

Arrays, Arrays, Arrays
I mainly come from a JScript classic ASP background and I'm liking both C#.net and JScript.net. Now I have to say... "What's happened to arrays?" They used to be so flexible and easy to use. Here are my quick questions... Am I allowed to create an array with a non specified length so that I can add to it? If not then how can I modify an array's length? Can I create an array with a named index eg myArray["apple"] = "tasty"; or is the hash table the equivalent for this now? The classic array methods and properties like pop(), push(), length etc... are ...

Help converting Delphi code using dynamic array
I am converting some Delphi code into C++Builder XE4. I don't know the proper way to decline and resize the dynamic array " lines" which is an array of "TLines". Can you show the c++ code to declare cpp_TLine cpp_lines; and then resize the array cpp_lines in the function cpp_Addline. Thanks //-----Start Delphi Code----- tpoint3d = record x,y,z: real; end; TLine = record p1,p2: tpoint3d; end; var lines: array of TLine; procedure Addline(ln1: TLine); begin SetLength(lines,high(lines)+2); lines[high(lines)]:=...

How to quickly delete an interface in a dynamic array? Delphi 2007
Hello all, I have a very large dynamic array that contains a list of interfaces. I want to delete one interface from the list quickly and the list must remain sorted. What's the best/fastest/most elegant way to do it? Everything I can think of involves Move() and pointer arithmetic. I was hoping for an elegant array.delete() function but the helpfile lets me down. My current sloooow method is to move the element that I want to delete to the end of the array (consecutively swapping it with the next element) and then calling setlength() to truncate the array, hoping/prayin...

Web resources about - How would you expect a dynamic array deep copy to be named? - embarcadero.delphi.non-tech

Dynamics - Wikipedia, the free encyclopedia
Brownian dynamics , the occurrence of Langevin dynamics in the motion of particles in solution (e.g. a grain in water, as was first seen by Brown); ...

Datacenter Dynamics
Datacenterdynamics for data center information, conferences, news, videos, whitepapers and reports globally

Dynamic Chiropractic - chiropractic, news, articles, research & information for chiropractors - Find ...
Dynamic Chiropractic - chiropractic, news, articles, research & information for chiropractors - Find a Chiropractor

Walmart's Everyday Low Prices Face Amazon's Dynamic Price Push
... low prices" strategy is becoming an everyday price-adjustment strategy. In what seems to be a direct response to Amazon's sophisticated dynamic ...

The colorful, dark, dynamic art of life: 2015 BioArt winners
In an embryonic mouse torso, researches closely track how the parallel paths of blood vessels (gray) and nerve cells (red) develop. Understanding ...

General Dynamics Corporation Delivers The Future of American Shipping
American Petroleum Tankers receives delivery of first ECO class tanker from General Dynamics\' NASSCO.

Mea Culpa: Confidence Proceedings Edition: I Really Do Think Dynamic Scoring Is a Bad Idea
... *Brad DeLong noted that when he was a Treasury political appointee, one of the Treasury career staff economists lectured me him about dynamic ...

dynamic billboards to up your photo game
NYC is one of the most photographed places in the world, especially this time of year. And while Instagram has made every one of us feel like ...

Yolanda Foster explains her divorce: ‘chronic illness changed our dynamic’
... is extremely challenging, not only for the person that’s sick, but also for the caregiver,” Foster admitted. “It for sure changed the dynamic ...

CES 2016 TV tech: 4K yawns, high dynamic range dawns
... Show in Las Vegas this January, TVs with 4K resolution are old hat. So what's new hat? The next-generation TV technology known as high dynamic ...

Resources last updated: 12/16/2015 11:04:14 PM