Open FullValueRider opened 1 year ago
@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. Preferable would liked some github links directly to the VBA code to examine incase getting confused exactly what to check and can examine online without booting up Excel.
Hmm "instantiating a SeqC rather than a SeqA." Is the twinBasic test exactly the same as the Rubberduck test? Maybe try some independent examples and step through. Highly unlikely an issue with the default property in VBA. Check the VBA attributes for class member default property in question incase out of sync or not generated? Or if another property for that class already the default member?
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
Dim myS as SeqA
Set myS = SeqA.Deb(1,2,3,4,5,6,7,8,9)
' rather than
Dim myS as SeqA
Set myS = SeqA(1,2,3,4,5,6,7,8,9)
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