> On 1 Dec 2016, at 17:36, Peter Jakobsson <li...@netkelvin.com> wrote: > > Strictly speaking it’s a bug - the fact that a method argument remains > coupled to it’s source in the calling method despite being explicitly passed > by value rather than by reference. > > myMethod($object) <— 4D’s pass “by value” syntax > myMethod(->$object) <— 4D’s pass “by reference” syntax > > At least thats the way I’m increasingly seeing it ;) > > 4D have done a fantastic job of making this very complex data structure into > “just another variable” for us in every other respect which I think is a bit > of genius actually. > > It’s just this 1 banana skin that’s been left in place. I think they should > get rid of it (the coupling between caller and called) and make it observe > the same syntax as all other data types. (The “banana skin” behaviour could > be left in place with one of those compatibility options in future upgrades > for safety).
Hi Peter, Honestly I disagree with you on this. There are other “data types” in 4D that are passed by reference. For example hierarchical lists, plugin areas, menu references, XML references. I ran a test this morning, to try and understand your point on how objects work differently in components. But they don’t work different. The example I showed in my previous email, worked just perfect when used with a component. So I don’t think there is a problem at all if you follow my advice from my previous email (create a function that works like a constructor; it initialises the object and returns it in $0). If I am not understanding you well, then please send an example by private email. HTH, - Rob Laveaux -------------------------------------------------------- Pluggers Software Scholekstersingel 48 2496 MP Den Haag The Netherlands Email: rob.lave...@pluggers.nl <mailto:rob.lave...@pluggers.nl> Website: http://www.pluggers.nl <http://www.pluggers.nl/> -------------------------------------------------------- ********************************************************************** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: http://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **********************************************************************