« first day (2091 days earlier)      last day (1089 days later) » 
00:00 - 18:0018:00 - 00:00

6:01 PM
so, if you grasp what vlookup is for, you're prepared to "get" SQL joins :)
 
but what about the outer joins? I think that's where beginners usually stumble on.
esp. because direction then matters
 
that's where you separate the kids from the grown-ups :)
 
LOL
 
actually...
 
infants from toddlers***
we'll still stumble, but we're well on our way to a less verbose understanding
 
6:04 PM
when creating the first Test Module in a project is that when the reference is set to RD?
 
an outer join doesn't destroy the vlookup analogy in my mind - just take #N/A and make that NULL
@SmileyFtW hm, I think so (IIRC running the tests also verifies if the reference is there)
note, it depends on your configuration; IIRC the reference is only added if config says tests are early-bound
 
I did a drag/drop using PE and compile complains about Rubberduck.Assert declaration... just looking for the easiest way to get the ref
yes, early bound
 
Rubberduck > Tools > Add/Remove References... > RD tlb should be under "pinned"
(side note: we should get that dialog's features to actually work as intended)
 
@MathieuGuindon wait, so it's actually more akin to a full join, no?
 
6:09 PM
@this nah, that one destroys the analogy proper :)
 
@Duga Can you assign an IUnknown to anything but an IUnknown?
 
Ok, good. So basically vlookup is just left outer join.
@M.Doerner you can assign anything to IUnknown, I think.
 
@this yeah
 
I mean the other way around.
 
hm, should we be treating IUnknown as any other Variant then?
 
6:11 PM
No.
Only objects can be assigned.
 
what about Any?
 
wait.
 
Should the inspection trigger if the IUnknown is assigned to anything that is not an IUnknown?
 
@this ah, so like Object then
 
Or a Variant
 
6:11 PM
Yeah, Object => IDispatch
 
We treat Object just like Variant in the inspection.
 
IUnknown means that it's not a dispatch but you know it's a COM interface.
I just checked; one can assign IUnknown to a variant.
 
so the fix is to just make the inspection treat IUnknown like Object and Variant then
 
for some reason I thought it couldn't be but I might be conflating it with something.
 
I already expected that based on the issue.
 
6:13 PM
Agreed.
 
@MathieuGuindon I looked at pinned and it wasn't... I thought that it would be there....
 
My question was rather whether it can legally be assigned to anything but IUnknown, Variant or Object.
 
Thinking about it some more - the issue with IUnknown would be only when you have a COM interface that inherits IUnknown but not IDispatch. In that case, you would not be able to assign that interface to a Object (and maybe Variant neither) because there's no IDispatch support.
In the example code, though, we only care whether the type is IUnknown, Variant or Object; since all are compatible.
 
@SmileyFtW in the "type libraries" tab, type "rubber" :)
 
k, thanks!
 
6:18 PM
> Rubberduck AddIn
> C:\ProgramData\Rubberduck\Rubberduck.x64.tlb
 
Hmm. now that makes me wonder what happens if one has a IUnknown-inherited interface and try to assign it to Object. Does that fire an inspection?
@MathieuGuindon note that path may vary. That's a per-machine install. Per-user install has it somewhere else in %appdata%
 
aye
the project refs search box would find it there then
@this if Set someObj = someIUnknown is a type mismatch, then yes. otherwise, no :)
wait no the other way around I mean - Set someIUnknown = someObj
 
no, that should always succeed.
Object => IDispatch => IUnknown
it's only when you have Foo based on a IUnknown-only interface, then you can't assign it to Object because no dispatch.
No compile error for that, though. I don't have a implementation of a library that has a IUnknown-only interfaces handy to verify what happens.
 
IOW the inspection should just bail out if IUnknown is involved
 
Not quite.
Public Sub x()
    Dim f As IFoo 'an IUnknown-only interface
    Dim o As Object

    Set o = f 'should be illegal
End Sub
No IUnknown here.
we'd have to see that IFoo itself does not implement IDispatch and thus can't be assigned to any other types except IFoo or IUnknown; not sure about variants, though.
That code will compile, though. I am not confident it will run, though.
 
6:39 PM
That's just set o = nothing, no?
IFoo can only be a user class here
 
[uuid(26387857-0462-4F01-B852-8D34BBFA60BA)]
library test_iunknown
{
	[uuid(26387857-0462-4F01-B852-8D34BBFA60BC)]
	interface IFoo : IUnknown {
		HRESULT Bar();
	}
}
I didn't new it up because I have no implementation for IFoo
 
and if f is actually set, then it's totally legal downcasting
 
I need to find which interfaces implements only the IUnknown and test but I am pretty sure that it's not legal to cast f to o because Object in VBA is basically IDispatch, so that's upcasting, not downcasting.
 
Interesting
I still believe it's completely legal, can't test it atm
(assuming IFoo is a class module)
 
No, it' s not. See the IDL above.
 
6:44 PM
Ah
 
All VBA class modules always implements IDispatch
The only time you'd see a IUnknown implementation is from an external library that didn't bother to implement the IDispatch. In this case, early-binding is required to use objects from that library.
 
I'm not seeing an easy way to fix that inspection then.... not without carrying some kind of flag from the ITypeLib loader that tells us whether a type implements IDispatch
 
7:01 PM
@MathieuGuindon .x32 or .x64 ? Is it for the OS or the Office type?
Nevermind... just created a module and it picked x32
 
the host - it's always the host :)
 
@this I think you think about a completely different issue than in the issue I want to fix.
Your issue is that we should not consider Object to be safe.
The issue is about the fact that IUnknown is always safe to assign to.
 
@MathieuGuindon going back through the typescript learning and office-JS, that will allow me to run scripts for Office-Online applications, but will I be able to edit them online (I'm still waiting on my ticket to get resolved if they will let me have access to ScriptLab, so just gathering info atm). Noting the line in your blog about the Excel-Online team working to get things up to par, it may not currently be applicable, but is the intent for Office-Online to both design and execute scripts?
the active editing issue is one that i can't verify without having, so relying on you... sorry =/
i believe the answer is yes, but didn't see it explicitly stated (significant inference in the section about Caret locatino dropping as moving between tabs)
 
@Cyril Script Lab edits and runs, yes
doesn't debug though
 
doesn't debug, but can you compile without executing?
 
7:15 PM
not that I know of
 
copy
thanks again
 
maybe in VSCode though
(or actual-VS)
 
intending to go through freecodecamp.org/news/… when i have a little more time to dive
trying to get some actual work things set-up atm
 
I don't like this: my tests are passing for the wrong reason.
Oh, to really test is, I have to reference stdole.
 
7:32 PM
I need to figure out if Mat's got a blog for testing... like how to and when. all i've ever done to date is to run the code (execute or step through) and debug when i have errors. i have seen testing code from iven and i simply don't comprehend that aspect, yet
 
@Cyril the thing with testing is that you simply can't do it with side-effecting code, and code with hidden dependencies - basically you need to fundamentally change how you write code, so that it's testable in the first place
i.e. every conversation about decoupling things has been about testing
 
i kind of assumed the decoupling things were related to having an abstraction (classes) rather than having them be too direct to a particular scenario... learning is fun
when you say "side-effecting" as in client-side, specific effects?
 
@Duga milestoneCountdown = 8
 
@Cyril take a SUM function - the function is easily testable, because it takes all its inputs and doesn't affect any global state. SUM(2, 2) will always reliably return 4.
@FreeMan eh, countdown jinxed it the other day :)
now take a function that reads a value from some file, multiplies that value by a given parameter, and sets Application.Calculation to xlCalculationManual
we can't possibly test that function, because it's going to hit the file system and alter global state
 
@Duga Someone unstarred... It was 8 yesterday.
 
7:46 PM
it has hidden dependencies in that FileSystemObject (or Open statement) being used
and if we write a test for it and run it two times in a row, we won't be able to verify that Application.Calculation was correctly set, because the first run has just interfered with the global state we're working with
so, testable code implies code written in a way that allows the test code to control the dependencies: ideally you don't want your test to fail because e.g. the network drive the function is accessing is disconnected
so instead of working directly with a FileSystemObject, you would take some IFileIO interface as a parameter, write a class that implements some IFileIO.ReadValueFromFile method using a FileSystemObject - and then your test code can provide an alternative, "test stub" implementation of that interface that won't actually hit any file system but allow your test to know that ReadValueFromFile was indeed invoked
 
...and implementing test stubs for every interface is a pain in the neck. that's why this PR is a game changer
 
so to high-level capture, in cases where you can keep thing within the "box" of the direct, local realm, do that...
 
well, it all hinges on what you consider your "unit"
 
the call/invoke concept regularly throws me, so i'm going to take a stab... in your example, you have the Class invokes FSO, rather than calling FSO within your code, so that you can circumvent/plan for errors and test
 
7:57 PM
maybe you're reading a value from some worksheet instead of from some text file
yes. essentially you're wrapping dependencies in code you can fully control
 
@MathieuGuindon oops... musta been a misclick.
 
note that these wrapper classes aren't testable: they're dependencies of the code/logic you want to make testable
 
@MathieuGuindon i think that hits on the "when" to test and part of where my confusion comes in
 
the way I see it, cells in a worksheet are just global state
so, any code that reads from or writes to a worksheet, can't be reliably tested without abstracting the worksheet away
I touched on that in There is no worksheet a while back
note, that particular approach is very heavy-handed
 
One example I run in frequently is that there is some configuration data on some sheet.
Instead of getting the data from the sheet directly, I have an interface IConfigurationProvider with a method to get the data.
 
8:05 PM
yep
 
and an implementation SheetConfigurationProvider that actually gets it from the sheet.
My other code then takes a, IConfigurationProvider and does not care where the data comes from.
 
and then you can have a TestConfigProvider that doesn't care for the sheet and just lets tests tweak it as needed
 
When tesing, I can just provide some StubConfigurationProvider that provides some data I want in the test.
^ (too slow)
 
@M.Doerner Yes. I was trying to remember the cases where IUnknown becomes problematic, and that does not apply in your fix. I already had answered that I agreed that it's safe to assign to IUnknown; it's only when you have an IUnknown or an interface deriving from IUnknown (and does not implement IDispatch) then it's not safe to assign to an Object (or Variant?).
The problem, however is finding an actual implementation that has a IUnknown derived interface and does not implement IDispatch to test this.
 
8:10 PM
I think you can assign absolutely everything to Variant.
 
Yes, there's a VT for IUnknown, IINM.
 
Finally, my test all fail correctly.
 
but what I'm not sure is whether you can do someVariant.someMethod on a Variant variable referencing an IUnknown-derived interface.
I do not think that will work since that would be a dispatch call.
In fact, having a Variant/IUnknown or IUnknown is fairly useless, unless all you care about is managing the object's lifetime without knowing about it.
 
but it should still be assignable I think
 
Yes, I think so, too.
 
8:15 PM
I think we should at least treat it as assignable, since we have no idea what it is.
 
@MathieuGuindon "So you name that range Header_AccountNumber"
 
VBA does not care about the declared object type at compile time.
The entire point of the two inspections is to warn about violations at compile time.
 
will go back and read through that post, mat... only got so far, but need to finish a task before a meeting in... 14 minutes
 
However, if we have absolutely no idea what the underlying object type might be, we should just not report a result.
 
For that inspection's purpose, yes, we should just treat IUnknown the same way we do Object / Variant
However, I can see an inspection for verifying that a variable deriving from a IUnknown interface isn't assigned to an Object or Variant variable.
 
8:21 PM
@this that would basically be specific to [_NewEnum] implementations, ...and that's all I can think of atm
 
as it happened, I was working on using some IUnknown interfaces, but the water get muddy because of this following situation:
Dim wb As ShDocVw.WebBrowser
Dim doc As MSTHML.Document
Dim customDoc As ICustomDoc 'Unknown-Derived interface

Set wb = Me.WebBrowser0.Object
Set doc = wb.Document
Set customDoc = doc 'Cast succeeds

Dim o As Object
Set o = customDoc 'Cast succeeds because implementation supports Dispatch
I have to dig a bit deeper to find an object that implements only IUnknown and see what the behavior is. As I understand, when that is the case, early-binding is the only way to use it.
Which is why I don't expect using Object or calling methods on it late-bound will succeed.
 
Arrgh, my tests are still wrong; we do not have serialized declarations for stdole.
 
But as you see above, when the implementation implements both, even though I've cast to a IUnknown-only interface, I still can cast back to dispatch because of the implementation.
@M.Doerner I thought comintern moved us off serialized declarations?
 
for prod, not for tests :)
 
Right, we do not have a serialized com project for stdole, then.
 
8:28 PM
wait, tests are also loading the actual TLBs?
read Mug, read
 
And my fix also does not work because IUnknown is an actual type in a references project.
It is stdole2.tlb:stdole.IUnknown for me.
The special casing should probably not be library specific.
 
ok, so let me know if im thinking about this correctly.

a PR between a fork and the original repo basically just moves commits from the fork onto the original repo, right?
 
 
@jcrizk Correct. It will take the commits from wherever commit you branched from and intregrate them into the "main" repo.
 
gotcha thanks lol i wanted to make sure what i said at work was correct
i started working in a fork of our repo at work because i have like 1million experimental branches that i wanted to get rid of from the main repo lol
 
8:39 PM
Don't forget to review the full manual directly.
 
Hm, we have the test files. They are just not wired up.
 
@Feeds yep. c.f. DinoTrucks
 
OK, now everything is wired up.
 
@MathieuGuindon wtf are DinoTrucks
 
Dinotrux is an American-Canadian computer-animated web series. It features a fictional prehistoric world inhabited by hybrid characters that are part dinosaur and part mechanical construction vehicle. The larger Dinotrux are accompanied by Rotilian Reptools who are smaller reptiles combined with mechanic's tools. The series debuted on August 14, 2015 on Netflix, with the second season following on March 11, 2016, and the third on October 7, 2016, and the fourth on March 31, 2017, and the fifth on August 18, 2017. Beginning in November 10, 2017, subsequent seasons are released under the tit...
 
8:48 PM
@BigBen you soooo don't want to know
 
How did this thing get a 7.0 on IMDB?
 
@BigBen Dinotrux is the reason for Mugs love of whiskey.
 
ahhhhhh.....
 
Nah, kids too old for it. Paw Patrol is =)
 
Rubble on the double.
 
8:52 PM
completely unrelated - I think this has been discussed on Meta - but for those of us who are still closing crap questions on SO, do you downvote too or is that unwelcoming?
 
@MathieuGuindon My first thought.
@BigBen It's like Barney. Parents get a 30 minute break while the sprogs are glued to the tube.
 
@FreeMan - I knew what "sprog" meant from context... but always happy to learn a new word :-)
 
@BigBen I only downvote these days (still voting on answers though, but curating Qs, meh)
 
ups my Scrabble game
 
@BigBen lol
 
8:56 PM
hey - Scrabble is very competitive
 
'tis a UKish term (at least in my hearing), but I liked it, so I appropriated it.
 
I need any edge I can get
 
@BigBen you've never been at my in-laws on Christmas... 0_o
 
:-)
The Midwestern equivalent of that scene would probably be euchre. Crazy tournaments at the relatives' house.
 
@IvenBach my son loves dinotrux
he's also pretty big into paw patrol... we don't own a television, so netflix having dinotrux has been helpful
the paw patrol is when he's getting his hair cut (they have that playing constantly at the locale)
@FreeMan i need to find that rodney carrington skit about barney... put it on and go to the bedroom with the wife cus you've got some alone time
 
9:08 PM
^sump'in like that. It's about the only way you ever end up with >1 kid
 
@FreeMan alternatively, make twins the first time around
 
@MathieuGuindon generally, one has little control over that. In that vein, I do know several people who went for 3rd and had 3rd & 4th at the same time...
 
that's precisely what's giving me second thoughts about wanting a 3rd... I mean, I'd like a 3rd, but don't know that I could handle a 4th!
 
huh... random icon vertical spacing, but in a different place, this time
#BlameCarlos
@MathieuGuindon from what I hear, once you're past 2, you're in zone defense, so 3 or 5 - it doesn't really matter...
 
9:23 PM
That had me nervous about the 3rd, as well. We ended up with just 3. Survived with the help of some Barney.
Whelp... ohs nos, it's snowing!!!one!!11! I'd better leave work!!!
 
Can VBA interfaces have events? Would it be possible to define an interface like INotfyPropertyChanged in VBA?
 
TTFN
 
@ZevSpitz nope
 
Question regarding the special case in ObsoleteCallStatementInspection: we only care about the case where the Call is in the first statement on the line and it is followed by a statement separator, right?
I.e. Foo: Call Bar should return a result.
But not Call Foo: Bar.
 
@ZevSpitz I think Mat had a SO thread about that and someone answered using an adapter.
 
9:30 PM
@M.Doerner aye, removing Call in Call Foo: Bar will make Foo: parse as a line label; we don't want to be responsible for doing that :)
 
Currently, we also do not return a result for Foo: Call Bar.
 
@this @ZevSpitz yep; and then I implemented it with the GridViewAdapter class of the Battleship project
 
hmm looks like it would break either way. We probably shouldn't for both.
 
Why?
 
there's no reason to not flag Call in LineLabel: Call DoSomething
 
9:32 PM
We just don't because of the implementation.
 
Sorry I got confused, thinking that Foo: Call Bar would end up making Foo an executable statement rather than a line label like the former case. Ignore me.
 
I do not really like the implementation anyway because it uses a CodeModule.
 
Just say no to drugs codemodule
 
I think it is really not that hard using the context.
 
too bad we don't have history prior to 2018-04-09, that makes me wonder just how old that inspection is!
(easy access to the history, I mean)
probably dates all the way back to the regex-based parser nightmare
 
9:43 PM
Why would that history not easily be accessible?
The inspection was created 2015-02-12.
 
how did you get to it? on github the file history ends 2018-04-09 when inspections were moved to Rubberduck.CodeAnalysis
 
git still has the history
It is all in the log, including file moves and renames.
 
git can do rename following for some cases
@MathieuGuindon do you mind if I edit your meta answer with a bit of information on how code-prettify works "internally"?
 
go ahead! feel free to make it CW if you like :)
 
I guess I cannot do too many other things anymore before tackling ProcedureCanBeWrittenAsFunctionInspection.
That really should be a declaration inspection instead of a parse tree inspection.
 
9:54 PM
why though? IIRC at one point we were converting a bunch of declaration inspections into parse tree inspections
actually, I think I can see why
 
It wants to know about references to its parameter.
The way it currently is written is kind of backwards.
In principle, it should not look much different than `ParameterCanBeByVal, just the other way around.
 
makes sense
 
@MathieuGuindon edit is applied
 
Hm, why does the inspection ignore interface members?
 
10:09 PM
and event handlers?
 
They are ignored for good reason.
 
"interface members" being on the interface class or the implementing class?
 
The implementations are also ignored.
 
consistent, good
 
My question is about those on the interface.
 
10:11 PM
the parameters would never even be in use on these
 
As for ParameterCanBeByVal, the check would be on all implementations, if any.
 
@Vogel612 nice, thanks!
imo it makes sense to ignore interface members and their implementations for this
flag an interface implementation, your quickfix needs to apply everywhere impacted
 
OK, that is easier anyway.
 
@M.Doerner oh I see - basically, inspect all known implementations before determining whether to flag or not... yeah that's kind of over-complicated... and then a referencing project that's not opened in the VBE might be implementing that interface.. we better just ignore them
 
We flag and fix for ParameterCanBeByVal. However, that is a far less involved fix.
 
10:17 PM
> and then a referencing project that's not opened in the VBE might be implementing that interface
ignore that, it's very much an edge case
 
Do we care about the situation where the parameter is assigned by passing it as a by ref argument?
 
we should, but ByRef assignments have been problematic since forever
 
Ignoring it would yield false-negatives here.
 
then again, last time it came up, we didn't have half the resolver capabilities
if it can be done without involving O(MG) complexity, then sure :)
 
I guess I will go one level deep as for the other inspections.
 
10:23 PM
sounds good
 
Hm, what we can look at there is rather restricted to be honest.
We can only determine whether the argument is assigned to if the called method is user-defined.
 
4.20.17
oops, wrong screen lol
 
happens
I regularly open new tabs when I want to find all.
Hm, the inspection worked a little different than I thought.
and the tests suggest.
It only cares about the first reference to the parameter.
 
11:03 PM
huh why would it do that
ttgh
 
If the first reference is an assignment, the value passed in is never used.
 
ugh. needs CPA.
(1st ref could be conditional?)
 
To be completely precise, yes.
I could make is more conservative for now, though.
I could require all references to be assignments.
Or assignments via ByRef argument.
 
gets tricky pretty quick!
bbl
 
@this you can index views, if you try to index a view with a sub query, it berfs on you. you then have to go turn that sub query into its own view, index it, then use that for the final view you want to index. granted, that doesnt always work because of the limitations on indexing views.
another question i've been thinking about, does access compile passthrough queries?
i ask because i know if you go and change the sql property of a querydef a bunch, it will recompile the query each time and create DB bloat
but if passthrough queries dont do that...
 
11:37 PM
@MathieuGuindon Thinking about it again, you can always write the procedure as function, as long as exactly one parameter is ByRef.
The question just is under which conditions we want to point the user to do so.
The quickfix just changes the ByRef to ByVal and adds a line at the end that assigns the byVal variable to the function result.
BTW, that will guarantee a result for ByVal parameter is assigned to.
 
good point
 
00:00 - 18:0018:00 - 00:00

« first day (2091 days earlier)      last day (1089 days later) »