Good grief NO!

That no has tried to correct this misconception is disappointing

As I understand it, in Xojo, class instances are always passed by reference.

NO NO NO NO 1000 times NO

A class is a REFERENCE TYPE but this is NOT the same as Byref

In cases of simple variables like integers and doubles the memory location holds the actual value
What this means is a line like

    dim I as integer = 99
  • sets aside a memory location to hold an integer
  • assigns the symbolic name I to it for future reference
  • puts 99 IN that memory location
    Operations on I alter the value held in that memory location
    This is called a VALUE type (the actual value is held in the memory set aside)

With a class instance what does that memory location hold ?
Obviously it cant hold a whole copy of the instance
What it DOES hold is a pointer (reference) to a larger chunk of memory that can hold the entire instance

When you pass a VALUE TYPE to a method you get a copy of the value - not the original
So to alter the original instead of the copy you have to use BYREF

When you pass a REFERENCE TYPE to a method you get a copy of the REFERENCE
But this still allows you to alter the CONTENTS of the instance (you’re altering the things the reference pleads to not the reference itself)

2 Likes

Don’t get upset, the did not get the concept and Ideas behind it.

The BS continues

As an addendum to Kem’s excellent example, it’s important to understand that due to compiler limitations, anything you pass into a ByRef must be a local variable. Consider these three examples:

NO it does NOT have to be a local variable
It MUST NOT BE an EXPRESSION
But a class property, module property etc CAN be passed byref certainly within the class’ or modules methods

Sheesh !

1 Like

“Pros” posting misleading and incorrect information just hurts the citizen devs

:man_shrugging:

3 Likes

Yeah, tht’s true in so many ways. The entire point is: they did not understand the concepts behind. And that shows: no pro. Citizen. That’s it. Theese entire show of look; I wriote a commercial Software and I am a pro developer. Nope. You may have written a Software which is commercialy sold. But a professional dev understands what he is doing. Simple, isn’t it? (I may have to look for my fireproof panties)

So many seem to take the “change stuff until it works” approach to software development and dont understand WHAT they changed or why
But It works !
:man_shrugging:

Yes but that is not professional development customers paying for. As long term consultant and developer for industrial apps I can say: I would not be able to get any job with this kind of behavior. The definition is: knowledge at the end and not who can do the best as try and error.

Also one thing I really hated on this Xojo support forum: often the answers are ending up with try the following possibly it would work. One reason why I was never really asking technical questions. But it has also to do with Xojo which has no real documentation. Simply a stupid software documentation should be. But they have none which is complete describing the product functionality and the component behavior and API’s. In their view it is not needed I guess. Also not a professional base I have to say. Not something I am used to using Java, C, C++ or C#. There I have a much better documentation with deeper looking on the API.

But at the end it is the developer which developed software. And if he is not coming up with the needed knowledge also heavy software bugs can be delivered for the future. Bugs which making problems over the time. Dangerous situation at all.

PS: happy new year from Germany!

1 Like

Happy new year from Canada !

Happy new year to all here. BTW, Norman, I think Trump is wrong. We can carve more than just one state out of Canada. :slight_smile:

I hope this never becomes an actually serious discussion.

2 Likes

18 posts were split to a new topic: Musks influence