-
Notifications
You must be signed in to change notification settings - Fork 300
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Possible VBA bug: Instatiation of a class using default memeber calls default member of wrong class. #6147
Comments
@FullValueRider How did you go? I had a quick peek a couple of days ago. Appears what you're doing is putting a default property on a factory method, unusual. Apart from that that was getting confused with the naming. SeqA, SeqC etc. Hmm "instantiating a SeqC rather than a SeqA." When get some time over the weekend will have another look. Good luck. 😁 |
Thanks for taking the time to look at this issue. The github repository is https://github.com/FullValueRider/VBALib SeqA, SeqC, SeqH etc are arraylist/collection replacements, the last letter denoting the 'technology' used to store items. The term seq I pinched from the nim programming language. The work around for the issue to to specifically call the constructor method
|
I also downloaded the files a few days ago and looked at the code, but I'm not seeing how it would be possible that the wrong type would be instantiated, or how implicit vs explicit invocation might differ. Would be interesting to be able to list objects and their respective members' addressing. |
Sorry for my lack of clarity. If you would kindly run SeqAtests in Module TestSeqA. What do you see in the immediate window.? |
Something to do with the parameterless SeqC constructor being invoked, resulting in an empty container being passed which may be handled differently in the SeqA constructor Complete guess Is SeqC constructor being called? |
Hmmm nah you would need brackets |
I'm seeking confirmation that I'm seeing an issue and not just suffering from familiarity blindness. I've attached the relevant xlam / twinbasic project below.
I have a number of classes of similar name which have a factory method declared as the default member.
I have encountered a situation where a call to instantiate SeqA object actually instantiates a SeqC object.
The specific line in question is (where Me is the SeqC object)
It is possibly more efficient to use
In the first case, test23c in module TestSeqC passes
In the latter case Test23C in module TestSeqC fails
When stepping through the code this the failure in the latter case appears to be due to the call to SeqA default method is actually instantiating a SeqC rather than a SeqA. I can't see any issue with my code so I think VBA is getting something wrong or there is a subtlety I don't understand.
If I export the code to twinBasic then Test23C passes in both of the above cases so, clutching at straws, I'm assuming the issue lies with VBA.
Would someone be kind enough to check my finding?
VBALibxlam.zip
VBALib_SeqCforSeqA.zip
The text was updated successfully, but these errors were encountered: