Bizarre behaviour of collections?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Bizarre behaviour of collections?

alexchernoff
This post has NOT been accepted by the mailing list yet.
Peace to all!

I have a sub that creates and adds a few elements to a Collection, like

Private Sub SendMessages()
Dim tMessage As New Collection
tMessage.Add("YYY", "XXX")

Then I pass this collection to a function that makes a few changes to it and writes it to a socket, like...

SendMessage(tMessage)

HOWEVER! The original tMessage collection is changed after that function does anything with it! How is that possible? After all, tMessage is a local variable to the SendMessages() sub.

isn't this weird or I am doing something wrong?

peace!

Gambas 3.9.2 Linux Mint 18 Cinnamon x64








 
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Bizarre behaviour of collections?

Charlie
This post has NOT been accepted by the mailing list yet.
Have you got some code to demonstrate this as I can't replicate the problem.

Check out www.gambas.one

Loading...