« first day (1725 days earlier)      last day (1455 days later) » 

12:00 AM
RELOAD!
[rubberduck-vba/Rubberduck] 1 opened issue. 3 issue comments.
 
:49190192 ?hex(12345678)
BC614E
?&h614E
 24910
e.g. it's only considering the 0-65535 range
since -1 = &HFFFFFFFF, it becomes 65535
 
WTH? This is just busted.
 
IKR?
 
> statement-label-list = statement-label ["," statement-label]
 
wait, what?
no
 
12:04 AM
Sub Til()
    GoTo Baz
Bar , Baz:
End Sub
VBE recognizes that and prettifies it.
Compiler barfs with sub or function not defined.
If you do this though:
Sub Til()
    GoTo Baz
Bar , Baz:
End Sub

Sub Bar()
    Debug.Print "bar"
End Sub
It's wrong number of arguments or invalid property assignment.
 
? no I get Variable not defined
 
On the top one?
 
for the one w/ Til
it highlights the Baz
(the one in the Bar , Baz: )
 
You have Option Explicit on?
I didn't try that.
 
yeah
 
12:07 AM
That's even more messed up.
 
w/o it, I do get the wrong number of argument
and frankly downright scary
 
I don't even know what , is supposed to be there
I have a feeling that it's not being interpreted as a line label
 
Multiple labels on one line?
Maybe someone was like, "uhhhh, that's stupid".
 
hmm
OK, let's start all over.
 
12:09 AM
Wait, WTH? on-goto-statement = "On" expression "GoTo" statement-label-list
 
Given this:
Option Explicit

Sub Til()
    GoTo Baz
    GoTo Bar
Bar , Baz:
End Sub
it highlights the Baz, Variable not defined
modify the code to...
Sub Til()
    GoTo Baz
    GoTo Bar
Bar , Baz:
End Sub

Sub Baz()
    Debug.Print "baz"
End Sub

Sub Bar()
    Debug.Print "bar"
End Sub
Baz is highlighted again but now says Expected: function or variable
 
On Error GoTo Foo, Bar, Baz thankfully doesn't compile.
 
That says to me that the colon there is being treated as a statement separator, not as a line label separator
In fact, removing the colon yields the same error still.
 
> A procedure must contain exactly one <statement-label-definition> for each <statement-label>
in a <statement-label-list>.
 
.....
Is Joel Spolsky gaslighting us?
 
12:12 AM
That suggests this:
Sub Til()
    On Error GoTo Foo, Bar, Baz
Foo:
    Debug.Print "foo"
Bar:
    Debug.Print "bar"
Baz:
    Debug.Print "baz"
End Sub
> If n is zero, or greater than the number of <statement-label> defined in <statement-label-list>,
then execution of the <on-goto-statement> immediately completes.
FML, I figured out what it means.
Sub Til()
    On 2 GoTo Foo, Bar, Baz
Foo:
    Debug.Print "foo"
Bar:
    Debug.Print "bar"
Baz:
    Debug.Print "baz"
End Sub
 
wait, wait.
 
^ goes to Bar
The expression is a selector for the GoTo.
 
i was about to ask which seciont you were looking at
hmm
Sub Til()
    Dim i As Long
    i = 2
    On i GoTo Foo, Bar, Baz
Foo:
    Debug.Print "foo"
Bar:
    Debug.Print "bar"
Baz:
    Debug.Print "baz"
End Sub
 
Sub Til()
    Dim jump As Long
    jump = 3
    On jump GoTo Foo, Bar, Baz
Foo:
    Debug.Print "foo"
Bar:
    Debug.Print "bar"
Baz:
    Debug.Print "baz"
End Sub
 
yeah.
 
12:15 AM
Woah.
That could actually be useful for some stuff.
 
hmm that is better than Select Case how?
well, if we want it to fall through....
huh, it parses fine.
 
Think Duff's Device.
 
That's basically the fall-through
would be interesting to see how many VB* programmers actually use that.
 
Right. Combine that with a loop and there it is.
 
Probably 2 or 3.
 
12:19 AM
Now.
Before this chat it was 0 or 1.
I don't even think I've seen that documented anywhere outside the spec.
Selective catch?
On Err.Number GoTo Foo, Bar, Baz
 
i think that's FUBAR
FWIW, neither is the On Error GoTo -1
which unlike the negative line numbers does compile without prettifying from a hex literal
 
Does that break with a line number of -1?
I'm curious what this means now:
 
yes it does
 
> If the n’th <statement-label> defined in <statement-label-list> is the same as the <end-label>
of the lexically enclosing procedure declaration, execution of the current <procedure-body>
immediately completes as if statement execution had reached the end of the <procedure-block>
element’s contained <statement-block>.
 
in that case it becomes a goto to that -1
#FunTimes
in fact, you can still break it with 0, too
 
12:27 AM
> end-label = statement-label-definition procedure-tail = [WS] LINE-END / single-quote comment-
body / ":" rem-statement
 
if I understood this....
Sub Til()
    Dim jump As Long
    jump = 4
    On jump GoTo Foo, Bar, Baz, Die
Foo:
    Debug.Print "foo"
Bar:
    Debug.Print "bar"
Baz:
    Debug.Print "baz"
Die: End Sub
 
Huh.
[end-label] "end" "sub" procedure-tail
procedure-tail doesn't appear to be defined anywhere though.
 
i assume that's why we have those endOfStatement grammar
which are just whitespace after the ending tokens
since in VBE, that also influcnes the line separator positioning
 
I thought that was end-label.
> end-label = statement-label-definition procedure-tail = [WS] LINE-END / single-quote comment-
body / ":" rem-statement
 
no, that's before the actual tokens, isn't it?
you have to put it before "end" and "sub"
 
12:34 AM
10 End Sub: Rem foo
 
isn't the colon just a statement separator there?
that would be no different from:
Private Sub foo()
10 End Sub
Rem foo
note that the procedure-tail apparently can include comments
oh FFS
I figured it out
the spec is messed up
 
lol
 
end-label = statement-label-definition
procedure-tail = [WS] LINE-END / single-quote comment-body / ":" rem-statement
 
:facepalm:
 
that's 2 separate definitions
 
12:36 AM
Joel forgot to hit enter.
 
IKR?
 
This explains much about VBA...
 
programming in VBA: Enter key optional.
so basically end-label is just a statement-label-definition that's just preceding the End <whatever>
 
Interesting. GoSub supports the same list syntax.
 
Needs a GoDestroyerInspection
 
12:40 AM
On n GoTo to Select Case refactoring.
 
hmm. can we tell if it's a duff device at use?
would have to check that all branches don't fall through
 
Probably not.
 
Also, it occurs to me that it can only work with numbers
That wouldn't work if the switch is on strings or something else.
 
Yeah, I was just considering On True GoTo Foo, Bar
 
uhhh, does that even work?
nah. RTE 5
 
12:43 AM
Compiles though.
 
the number can't be a negative number
yeah that was kind of implied in RTE... ;-)
 
On Choose("Foo", "Bar", "Baz") GoTo Foo, Bar, Baz should work.
 
gasp you found a use for Choose!!!
 
lol
Oh, wait, I didn't. That's not how Choose works.
You can tell how often I use it...
 
hmm
was it Switch? (looks up help)
no.
I guess one'd have to handroll the function to switch.
which feels like overengineering it just a teensy weensy.
 
12:47 AM
I could abuse the hell out of this.
On InStr("ABC", letter) GoTo Foo, Bar, Baz
 
"Let's use On N GoTo, but wait, we need to convert the strings into a number, so let's use a function with a Select Case to map the strings to numbers!!!"
that only works if it's sequential, though.
("FooBarBaz", "Foo") might not work as well, esp. not w/ variable length strings
 
Private Enum SomeEnum
    Foo = 1
    Bar = 2
    Baz = 3
End Enum

Public Function SomeEnumToString(Value As SomeEnum) As String
    On Value GoTo Foo, Bar, Baz
Foo:
    SomeEnumToString = "foo"
    Exit Function
Bar:
    SomeEnumToString = "Bar"
    Exit Function
Baz:
    SomeEnumToString = "Baz"
End Function
 
Yep, that works. But if your source data is string, you gonna have to convert that into the enum value somehow. #ReadingComprehensionFail
 
That's just plain evil though.
Dim x as Rubberduck.Reflection
 
Actually the above still can be done as a Select Case
 
12:52 AM
^ That's why it's evil.
 
JumpTableInspection?
Jump tables aren't evil in themselves. It's just too easy to get it wrong.
 
Now you're giving me ideas...
You could build a vtable with that.
 
Ok, but doesn't the syntax require you to enumerate all slots even if it's not used?
 
Yep.
 
and it wouldn't handle the negative numbers, either
(e.g. the enumerator or evaluate members)
not sure if it'll handle the 0 (default member)
 
12:58 AM
Heh. Here's a use: On Int(3 * Rnd + 1) GoTo Foo, Bar, Baz
 
oooo
 
The big problem with Enums would be the complete lack of type checking.
 
that would work for stuff like "Tips of the day"
 
Yeah, although you could do that with a Select too.
 
lol
yeah, you're right.
I think that's why it's almost never heard of.
99+% of the time, you don't want your jump table to fall through
there is a reason why C# is persnickety about having break in its switch.
 
1:00 AM
I was thinking more along the lines of "give me an array with a random number of elements (with values).
 
Ok, that's a better example
 
Or maybe "let's see what happens if we jump to a random point inside your procedure".
 
thinking about it - we probbably could inspect for bad usages of On N Goto
 
Like all of them?
 
if the count of Exit/GoTo is equal to the branches specified in the On N GoTo, then assumes it's bad
if it's one or more short, then it might be ok.
OTOH, On N GoTo might just confuse the hell out of the unwary
hmm is it even documented?
seems so
On...GoSub, On...GoTo Statements
huh.
If expression is Then
Equal to 0 Control drops to the statement following On...GoSub or On...GoTo.
Greater than number of items in list Control drops to the statement following On...GoSub or On...GoTo.
Negative An error occurs.
Greater than 255 An error occurs.
so no more than 255 targets, I guess.
 
1:05 AM
ExcessiveLabelCountInspection?
 
probably will only get fire exactly once out in the wild, by that lonely one who knows about the On GoTo statement
 
Something like this could be potentially useful:
Sub Foo()
    Dim i As Long
    For i = 1 To 3
        On i GoTo Foo, Bar, Baz
Foo:
        Debug.Print i
Bar:
        Debug.Print i
Baz:
        Debug.Print i
    Next i
End Sub
 
and let's be honest, do you really want to write a On N GoTo Sub1, Sub2, Sub3...Sub253, Sub254, Sub255
 
Maybe calculating permutations?
 
feh. I would say do it in SQL.
 
1:11 AM
That's easier in Access than, say, Word...
 
so use Access from Word.
 
Requires both Access and a database, no?
 
Nope
for those that needs to use an Access application, there's Access runtime. For those that needs to use an Access database, without any UI, there's Access redistributable. Both are freely distributable.
I need to double check but I think all Office editions have Access redistributable included to support other applications' feature that depends on it (e.g. Word's mail merge and Excel's old query editor)
 
So use the ACE engine without a backing database?
 
Actually even if it doesn't, Windows (even up to 10) still ships with DAO 3.6/JET 4.0 as part of the MDAC. That was the last version that was a part of MDAC before Access team took it over (back in Office 2007) and privatized it.
uh, you can create a database with an ACE engine.
 
1:21 AM
Oh, sure. But for something like a select without a table expression you shouldn't really need one.
i.e., select 42
 
I don't think you can do that w/ Access - it's always file-bound, basically. You'd have to open a database before you can get to SELECT 42
and even so, not all forms of SELECTs without FROM work; Access may want a dummy table in some cases.
My point earlier was that if you're doing lot of permutations, you should be doing SQL, and storing the data in tables, so that's a given.
 
Hmmmm... Although you could use the text connection string to some arbitrary file I guess.
@this I think that would depend on the set you're working with. If I need permutations of 4 values, it would probably be faster to just generate them "manually" in code than to even make a DB connection. If you're talking higher orders, like say 20 or 30, yeah - database (otherwise you start having memory problems).
 
Agreed.
There's also the matter of whether the permutations is fixed or variable.
If it's variable, then I ain't as hell going to put it in code.
@Comintern actually you don't even need a file - only folder:
 
Meh. Pop a MsgBox or something. "Are you sure you want to do that?"
 
Public Sub Example()
    Dim eng As DAO.DBEngine
    Dim db As DAO.Database

    Set eng = New DAO.DBEngine
    Set db = eng.OpenDatabase("", False, True, "Text;DATABASE=C:\temp\")
    Debug.Print db.OpenRecordset("SELECT 42").Fields(0).Value
End Sub
Lol
 
1:30 AM
Oh yeah, I forgot you could use folders.
I'm too used to providing schema files I guess.
 
oh, unrelated - have you ever seen On Error GoTo -1 documented?
I'm not seeing it in either the help files nor the specs.
I'm just going off the SO thread that was linked.
 
Not that I can think of.
It's not in the MS VBA docs.
 
and I mentioned there was an error about the error range
 
> If the <error-behavior> has a <statement-label> that is a <line-number-label> whose data
value is the Integer data value 0 then the error-handling policy disabled. If the <error-
behavior> is any other <statement-label>, then the error-handling policy set to goto the
<statement-label>.
 
in the docs it says it's valid from 0 to 65535, but makes allowances for the vbObjectError, which is a bit messed up.
Public Sub Test()
    DoIt -1
    DoIt 0
    DoIt 1
    DoIt 65535
    DoIt 65536
    DoIt vbObjectError - 1
    DoIt vbObjectError
    DoIt vbObjectError + 1
    DoIt vbObjectError + 65535
    DoIt vbObjectError + 65536
End Sub

Public Sub DoIt(ErrNumber As Long)
On Error Resume Next
    Err.Raise ErrNumber

    Debug.Print ErrNumber, Err.Number, Err.Description
On Error GoTo 0
End Sub
-1            -1            Automation error
 0             5            Invalid procedure call or argument
 1             1            Application-defined or object-defined error
 65535         65535        Application-defined or object-defined error
 65536         5            Invalid procedure call or argument
-2147221505   -2147221505   Automation error
-2147221504   -2147221504   Automation error: Invalid OLEVERB structure
-2147221503   -2147221503   Automation error: Invalid advise flags
-2147155969   -2147155969   Automation error
 
1:37 AM
> Long that identifies the nature of the error. VBA errors (both VBA-defined and user-defined
errors) are in the range 0-65535. The range 0-512 is reserved for system errors; the range
513-65535 is available for user-defined errors. When setting the Number property to a
custom error code in a class module, add the error code number to the vbObjectError
constant. For example, to generate the error number 513, assign vbObjectError + 513 to
the Number property.
 
added one more: DoIt &H7FFFFFFF
 
I think that might have to do with the HRESULT structure.
 
2147483647 5 Invalid procedure call or argument
yep looks like it
so anything between 65535 to the int32.MaxValue is nixed.
 
The "code" is the low order 16 bits.
 
That isn't exactly called out in the specs.
the vbObjectError part kinds of allude to it, but leaves too much to the user to fill it in.
 
1:39 AM
Object error would correspond to the "facility" segment, no?
 
=> &H80040000
 
Oh wait no.
Or kind of.
It's a bit mask.
8 is "failure" in that mask.
 
correct
1000000 00000100 00000000 00000000
> 4 - ITF (COM/OLE Interface management)
 
The 4 is FACILITY_ITF - "The source of the error code is COM/OLE Interface management."
 
Yeah
so it's a facility code
 
1:44 AM
So, Failure...COM
 
AIUI, that also means it's library-defined
IINM, ADO for example has errors in that range
so you'd have to look at its definition to determine what it actually means.
 
Oh, you mean look at the ADO definition.
 
yes for the errors in that range w/ the facility of 4
but what this basically does mean is that users can't define or use an error number > 65535, and while it looks like the user can use any negative error numbers without such restrictions, it might be... bizarre.
 
I'm curious why it doesn't set bit 29 too.
 
err.Raise &h80010000 => Automation error
not very helpful.
 
1:48 AM
It's a little helpful.
> The source of the error code is an RPC subsystem.
 
no, i meant that the VBE didn't show that error
it just says Automation error, without the actual detail
 
Oh, right.
Laziness.
 
therefore, for the sane VBA project, I think there's no point in calling anything else outside the 0-65535 and the vbObjectError - vbObjectError + 65535 ranges.
 
Correct.
I'm a bit surprised it allows overflowing into the facility segment.
 
IKR?
someone got a bit too lazy with the range checking in the error handling there.
 
1:53 AM
InvalidHresultInspection
 
^
writing an issue now
 
Completely unrelated, what's the utility of #2752?
 
what I don't get is this, though:
doit &h80040000
-2147221504   -2147221504   Automation error
Invalid OLEVERB structure   VBAProject
WTH would it be an "invalid OLEVERB structure"?
@Comintern hmm. That would be a question @IvenBach should answer
 
Probably this:
> In Windows, a group of flags taken from the flag constants beginning with MF_ defined in AppendMenu. Containers should use these flags in building an object's verb menu. All Flags defined in AppendMenu are supported except for MF_BITMAP, MF_OWNERDRAW, and MF_POPUP.
You can literally pass an invalid OLEVERB structure.
 
I kind of can see a need to differentiate between a procedure Remove from a comment remove
@Comintern but the point is that &H80040000 is just an vbObjectError
 
1:58 AM
Oh, WTH, not HTH.
 
actually it looks like the vbObjectError + n returns a similar group of error messages.
it's as if it's defaulting to .... whatever it is defaulting to.
 
It's in the headers as OLE_E_OLEVERB
Although now that I think of it, any non-zero hresult is an error, so why not use zero?
OLE_* all use the &H80040000 range.
 
Ok, that kind of makes sense in a backward way
So vbObjectError isn't just a reserved section. Oh, joy.
 
IKR?
What's odd is that Error seems to always give "Application-defined or object-defined error" for that range.
 
Yes - and that annoys the heck out of me.
I know that in case of Access, you can get error numbers > 513 which VBA will give Application or object-defined error.
In that case, you can use the function AccessError() which will then give the error message you would see via Access UI
example:
?accesserror(3011)
The Microsoft Access database engine could not find the object '|'. Make sure the object exists and that you spell its name and the path name correctly. If '|' is not a local object, check your network connection or contact the server administrator.
Err.Raise 3011 will just give a Application-defined or object-defined error
now, I bet that if you interop'd via .NET, you get a HRESULT which would be basically 0x80040BC3
(untested - I need to actually prove that)
 
2:09 AM
That would make sense though. At least you have AccessError. I'd kill for ExcelError.
 
IKR? 1004 is most unfun error message there is.
 
Error 1004 - "Yer doing it wrong"
 
2:28 AM
@Comintern That was when I first started coming to the pond. IIRC TODO: REMOVAL vs TODO: Removal vs TODO: removal` was the case sensitivity request.
 
@IvenBach OK, confused then.
The marker there is TODO, not "Removal".
 
2:52 AM
I probably wanted the ability to turn on or off TODO for specific words. I didn't realize what TODO was actually doing at the time.
I'll close it.
 
> Requested this when first found the pond. Didn't fully realize what it was doing.
 
 
1 hour later…
3:54 AM
> According to the MS-VBAL specifications, which unfortunately also leaves too much to the reader to fill in the bits, the expected error range is `0-65535`. It does talk about `vbObjectError` which technically is outside the range. However the specification also fail to mention that `0` is apparently handled differently by VBA, and that behavior is different if you try to specify an error number outside of the 2 ranges:

```
1-65535
vbObjectError - vbObjectError + 65535
```

If you try t
 
 
2 hours later…
5:31 AM
> This is more of a support request than bug report. Sometimes I can use the refactor menu but most of the time it is disabled. I can't tell what the pattern is between working and not working. I'm using Parallels to run Windows and the only reason installed Parallels and Windows was to make us of Rubberduck so I'd really like to get it going. If anyone has successfully used Rubberduck on parallels please let me know.

The info below can be copy-paste-completed from the first lines of Rubber
 
 
6 hours later…
11:48 AM
> First, just to reassure you - Parallels has no bearing on the issue. I use VMWare, and it works.

Next, though you say you refreshed, and the screenshot show `Ready`, the status bar doesn't seem to agree with what is selected. For one, your selection is inside the procedure `GroupIngredientsFromIngredients`, but the statusbar shows that you are in `AddIngredientsFromRecipesAndGroupBy` procedure.

Did you edit things while it was parsing or after it said `Ready`? It would make the tree sta
 
@Duga it's also thinking the procedure is a function.
 
12:10 PM
howdy @MathieuGuindon
I did an experiment with my Visual Studio installation installing the SDK kit for .NET 2.1
Found a .NET object generator that generates html or image version of the C# and assemblies.
its under Apache licence. :(
but it generated a nice summary of the RD 1.0 I thought would be good to see,
you can download the actual html I saved onto my github.
^ the actual generator I used.
I would later try the Prerelease later but complained of multiple project files. I need to specify different files. anyhow I better get to bed. see ya.
 
Huh, interesting!
 
thanks. Just download your copy of my .html and let me know. Feedback welcome. Its the object model made using Roslyn parser on .cs and .net assemblies.
 
12:38 PM
> First, just to reassure you - Parallels has no bearing on the issue. I use VMWare, and it works.

Next, though you say you refreshed, and the screenshot show `Ready`, the status bar doesn't seem to agree with what is selected. For one, your selection is inside the procedure `GroupIngredientsFromIngredients`, but the statusbar shows that you are in `AddIngredientsFromRecipesAndGroupBy` procedure. Furthermore, the procedure is a `Sub` yet the status bar shows it as a function returning a vari
 
@MathieuGuindon Thanks, updated. I also had a look at the log just now. Surprisingly, it does not have any trace entries for the actual parsing itself. It's just a bunch of hotkeys and subclassing hooking/unhooking. Only last few lines mentiones that inspection results has ran. It shouldn't be possible to run inspections without parsing at all... right?
 
> The toolbar mismatching the selection looks like the code was modified since the last time parser state was updated. Keep in mind that the VBE is not telling us when the code changes, so if a `Function` became a `Sub` and moved 10 lines underneath where it was last time Rubberduck parsed the code, then refactorings being disabled isn't a bug: running any refactoring or quickfix against a stale parse tree is pretty much guaranteed to wreck the code, so we disable it.

"Refreshing" essentially
 
@this indeed
 
Wondering how he could have managed to arrive at the Ready without any trace.
 
maybe removed the log entries?
 
12:50 PM
haven't looked at the logs, are there TRACE entries?
 
Yeah
there are a lot for subclassing and for hotkeys
 
Or yeah, log file was modified
 
but only 2 lines aout inspection results have ran.
Would be very selective modification. We still have the starting header at the top of the log
 
The repro steps don't jive, could the non-maximized code panes be messing something up?
 
There's other thing:
2019-02-25 13:13:06.0534;TRACE-2.4.0.4556;Rubberduck.Inspections.Abstract.InspectionBase;Intercepted invocation of 'SheetAccessedUsingStringInspection.DoGetInspectionResults' returned 32 objects.;
2019-02-25 13:13:06.0748;TRACE-2.4.0.4556;Rubberduck.Inspections.Abstract.InspectionBase;Intercepted invocation of 'SheetAccessedUsingStringInspection.DoGetInspectionResults' ran for 813313ms;
2019-02-25 13:13:06.4717;TRACE-2.4.0.4556;Rubberduck.Inspections.Abstract.InspectionBase;Intercepted invocation of 'UnassignedVariableUsageInspection.DoGetInspectionResults' returned 41 objects.;
oh, NVM. I thought the times didn't match but now seeing it formatted, it is fine
(for some value of "fine")
 
12:56 PM
yeeeesh
that's some heavy stuff there
 
the code pane's size seems to have no bearing.
 

« first day (1725 days earlier)      last day (1455 days later) »