You are viewing a single comment's thread from:

RE: Chess Programming, I am not using Ruby anymore

in #writing8 years ago

There are many languages where b = a will not create a copy of the object, but instead just point the variable a to the value held at object b. This is actually intended language behavior. It is the same in the language I use, smalltalk.

If you google "ruby copy" or "ruby deepcopy" you will find some pages with instructions on how to do a copy or deep copy in Ruby.

Sort:  

Yeah there is a work-around, but I am really not interested.
I would like if I could say b=aand get a new thing that is not just a reference

the weird thing happens when I change it at the top level, then a is unaffected, but when I copy inside a function or something like that a is also affected, if this is intended behavior I am out of that language.