« first day (1498 days earlier)      last day (1682 days later) » 
00:00 - 16:0016:00 - 00:00

12:00 AM
RELOAD!
[FreezePhoenix/Angels-And-Demons] 1 commit. 6 additions. 3 deletions.
[rubberduck-vba/Rubberduck] 4 commits. 1 opened issue. 38 issue comments. 472 additions. 34 deletions.
 
@Comintern I'm curious, what was the Professional feature you were missing earlier, that would have helped the problem at hand? I thought Community and Professional differences came down to licenses and MSDN access.
 
@ThunderFrame Trying to remember what it's called. It's the references\test results\etc. display above the function names.
Gimme a sec and I'll screen-shot it.
In a real project it also shows things like number of unit tests, number of passing tests, etc.
 
I love VS Enterprise for having that
I love that MVP gets me VS Enterprise =)
 
12:16 AM
 
If we implement that in our panes, can we call it the same?
 
I would doubt it, we'd probably have to call it DuckLens or something.
 
Ha! Awesome nonetheless
That means custom IntelliSense has to be ...QuackSense?
 
It's addictive as hell - especially the source control integration.
 
12:18 AM
That has a better ring to it than RubberSense.
RubberSense sounds like a brand of condom.
If we do a code coverage feature for unit testing, we absolutely have to call it "Duck and Cover".
 
OK, I swear I'm ready to completely reinstall VS. I can't get around the testing error at all. AFAICT it's an issue with MSBuild for .NET Core.
 
R# test runner doesn't seem to work, but VS does AFAICT
 
Sometimes I wish I could downvote @UserVoice feature requests... The number of votes on this one is deeply worrying. Are that many people stuck in 1980? https://twitter.com/ITImpactInc/status/1017529807490502658
 
12:33 AM
For some reason it was loading the MSBuild for Core, but that references an older System.Xml.XPath.XmlDocument assembly than nunit.
Ahah! The .NET Core uninstaller left a bunch of residual crap.
 
12:53 AM
@MathieuGuindon Exactly! Also, when you think about it, even VS' stacktrace include the line number. Unlike VBA, the line numbers don't form a part of the code. The feature request need not mean that it be part of the code. But really easier if they just bought Wayne out.
 
@this any idea who's behind the uservoice request for line-numbers?
 
a "Greg". No idea who he is
 
Oh, clearly I have no idea how big IT Impact is.
 
No, that's not him.
The one that Mat's relying to is my boss.
 
Yeah sorry, the tweeter, not the OP. I assume you have different views to your boss WRT line numbers?
Oh wait, just read your chat to Mat properly.
 
1:01 AM
In fact, I wrote a quick and dirty macro to line number a function for my boss just a couple months ago.
 
@Comintern paid by the number of lines?
 
lol
 
Ah sorry, my bad. Yes the tweeter is my boss; I think the item got floated for promotion.
@Comintern why not use MZ Tools? Or even vbWatchDog? That would have been much cheaper than paying you, I think.
 
@this It took less time to write than to download.
 
i'm sure.
it's until you edit stuff or whatever it goes out of the side. At least vbWatchDog's line numbering is done right.
 
1:04 AM
@Comintern there was an answer on SO last week where the user thought that an Integer used more memory than a Long because it used more characters to type. We assumed he must be paid by the character.
 
@ThunderFrame No, then he'd be arguing for the other way around. He would have to be paid for using less character, not more. (how does one measure that....)
 
I dare somebody to pay me by the line.
148
A: Longest code to add two numbers

CominternC - 2,739,341,494,945,868,415,002 (Not including whitespace) Brute force for the win. Only handles integers, and preserves overflow behavior. Here's a snippet of the code: int addnumbers(int x, int y) { if (x == -2147483648 && y == -2147483648) return 0; if (x == -2147483648 && y == -21...

 
@this makes more sense to show line numbers as a title row adjacent to the code. The toolbar is enough IMO, but I can see how having multiple line numbers visible might help in certain situations. Might also be useful to show physical/logical line numbers, depending upon what you're doing. Just keep them out of the code.
 
Should I have a version 15.0 key in `HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions`?
AFAICT, VS0217 is using the MSBuild from VS2015.
 
@Comintern but if you wrote a function to write the code, you would be paid for that function, not the output.
 
1:09 AM
@this except the feature request is completely talking about line-number labels
 
@this Shhhhhhh....
 
@this sorry for the conversation you're going to be having with him tomorrow :)
 
@MathieuGuindon One would hope that MSFT would be a bit more smarter than to accept it at face value.
@MathieuGuindon I'll live.
but I saw why - in the feed he's promoting all VBIDE UV items - which isn't surprising since he wants them to invest more. Despite what they say, we're still making solutions with "1980" programming language today.
 
Our use case is simply tech debt. We have production VBA code with a main working function that is ~1000 lines long (it's a huge loop with about 30 global state variables). It's used by non-technical customers, so we don't put any useful error details in the message boxes. The project is locked, and we open it in its own process so it won't assert a debugger. Line numbers and Erl :shudders: are the only thing that makes it remotely maintainable.
 
1:14 AM
if only there was a VBE tool with an extract method refactoring...
 
@ITImpactInc If you need a line number to find an error, your function is doing too much. Refactor to the point where you don't need to number lines and you'll also be rewarded with much more maintainable code. Crutches are only useful if you can't walk yet.
@MathieuGuindon Oh, I re-wrote the entire thing in my spare time. It runs about 10 times faster and it's completely OO. Management doesn't want to spend the money to run it through QA until it's broken to the point that they have to.
It was reminiscent of the legacy SmartIndenter code base.
 
damn, for a split-second I read that you had single-handedly rewritten the RD refactoring
@Comintern ouch
 
If I had, I currently have no way to unit test it. :-/
 
1:30 AM
OK, WTH does the VS2017 installer insist on installing the .NET Core toolchain?
 
1:41 AM
ok that's a tough one. the Call MsgBox( off-by-one crash? VBE is "helpfully" removing the empty parens when the autocompleted line is inserted, so I do module.ReplaceLine(pSelection.StartLine, "Call MsgBox()");, and still end up with Call MsgBox on the line
I mean, that's not the off-by-one (that one's fixed)... but the result is that there's no way to open parens when you use an explicit Call statement
...which... is ...interesting...
ideas?
 
> Another work-around is to avoid `Call` altogether.

In fact, I've got the off-by-one under control, but a quirk of the VBE is literally preventing the insertion of the empty parentheses - they get "helpfully" removed as soon as they're inserted, making the `(` keypress feel like it's simply not working.
 
ok, I know what I'll do. I'll add bogus TODO content between ( and ), and select it
 
What about sending something like (.) and then "deleting" the .?
 
the only way the VBIDE API lets me write to the code pane, is by replacing an entire line
that triggers "prettification"
so I can't delete that dot
might as well make it TODO, no?
 
Does it set the caret?
 
1:48 AM
it being immediately selected won't impact typing at all
@Comintern it puts the caret on the next line, so AC needs to reposition the selection
...while accounting for any whitespace adjustment the VBE made
 
If you can immediately select it, you could easily just PostMessage a delete keystroke.
 
except I'm already in the msgloop handling/eating a keystroke...
 
Hmm....
I'm trying to remember - does changing the lparam in the message handler alter the keystroke?
 
didn't try, but then not eating the keystroke changes the logic quite a lot
 
Yeah, I imagine it would.
Why does working with the VBE always involve hacks?
 
1:52 AM
because the VBE is a hack?
 
Ah yes - hackishness is viral.
 
if extending the VBE was easy, we wouldn't need Rubberduck, right? ;-)
 
OK, if this VS reinstall doesn't work, I'm seriously considering reinstalling Windows and starting from scratch. What a PITA.
You'd think it was the VBE or something.
 
oh shit
this is not going as planned
ok screw this. I need a plan B
 
...and still no tests.
 
1:59 AM
OTOH, I kinda like that making a Call statement is impossible with AC on
 
@MathieuGuindon Now that I at least have an IDE again, where's the code you're working with?
 
Rubberduck.Core.AutoComplete
 
Pop up an obsolete call inspection result instead.
 
if (IsCallStmt(original)) { StripCallStmt(); }
seriously the only real fix is to remove the Call statement
the off-by-one is on AutoCompleteBase line 96 BTW; prettifiedTokenIndices is empty
 
Can't you just suppress it autocomplete as a special case?
 
2:03 AM
that's what I'm thinking
but then foo = Recall( needs to work too :)
 
I hate to be that guy but -- if that's so problematic, should we be devoting our effort to making a AvalonEdit codepane?
 
@this yeah but I just want to deliver a 2.3 that doesn't crash all the time...
ideally by August
 
yeah, fair point.
 
it's really just patching - I have AC half-rewritten in another branch
 
Toolchain problems suck. Doesn't help that the configuration looks completely different than it did in VS2015.
OK, that was dumb. I was trying to test some auto "correct" behaviors and just crashed Excel. Note to self, disable RD first...
What happens if you append a backspace to the end of a string that gets passed to ReplaceLine?
 
2:10 AM
what's the character for a backspace?
there's no WM_KEYDOWN message for backspace..
no wait
yeah there's no WM_CHAR message for backspace
I'm handling backspace through WM_KEYDOWN
 
It's 0x8.
 
trying it. expecting a ? in the code pane
or some other junk
 
I was thinking more along the lines of module.ReplaceLine(pSelection.StartLine, code + " \b");
Kind of like how you can update an existing line with Console.Write
 
same
..and the result is... sweet nothing. it's ignored.
 
weird.
Now I'm curious if it would compile. I may have to try and break things.
 
2:18 AM
@Comintern IKR! Console AC was much easier!
19
Q: Autocompleting console input

Mathieu GuindonYesterday I stumbled upon a Stack Overflow question that asked if it was possible to implement Tab-triggered auto-completion in a console application. I thought that was an interesting idea, so I went ahead and wrote a small program that does just that, given a hard-coded string[] - I might even...

actually that was kinda lame
 
Does CodeModule.AddFromString have the same behavior? You could call module.ReplaceLine(pSelection.StartLine, string.Empty); first, then call AddFromString.
 
hmm, everything points to the VBE immediately prettifying the inserted code
haven't tried though
also, losing member attributes on module rewrite is one thing, losing member attributes when typing code inside a procedure is... another
question: is a Call statement the only instance where the VBE would be so helpful as to remove trailing, empty parentheses?
 
Yeah, just tested. AddFromString does the same thing.
 
and nukes all member attributes ;-)
 
I'm assuming that it's Call and not MsgBox...
 
2:32 AM
yeah msgbox() works fine
but call msgbox() becomes Call MsgBox
 
Do you have easy access to the references?
 
which refs?
 
From the parser.
 
not in AC
 
Damn. I was thinking of defaulting it to MsgBox(""), but to be a general solution you'd need to know the type of the first parameter (or whether it had one).
 
2:35 AM
yeah, no. I can't assume the initial parse has happened
 
Right. That makes sense.
And you're already in the message pump... Hmmm...
Do we know what window messages the VBE sends to the code pane when it does it's prettify?
You could just set a flag and eat them.
It has to be sending a set text message or something like that in order to update the control.
 
@Comintern God I wish!
 
Gimme a sec, I'll Spy++ it.
 
2:54 AM
@MathieuGuindon once we get declarations from TypeLib, we could have signatures worked out without a full parse. Or, we could just pre-parse the declararations rather than every line, and that would be faster. My preference would be using the TypeLib.
 
yeah
that'll be useful for Intelli QuackSense
 
OK, the ReplaceLine triggers a WM_NOTIFYFORMAT exchange.
I can't find the control message though.
 
typing the ( character nukes the Call statement. I can't add an extra whitespace without intercepting that WM_NOTIFYFORMAT
not exactly intuitive, but totally surprising enough to never want to make a Call statement again
 
if you replace Call MsgBox(| with Call MsgBox(1|) then send a {backspace}?
 
I can't send a backspace
at least not through the VBIDE API
 
3:09 AM
I think that's reasonable.
 
sure, but with win32?
 
TBH, Call adepts can disable parenthesis AC if they want it that bad
 
but then, you could just send all of the keys
 
I don't think the client area of the code pane is attached to the message pump at all. The wierd thing is that it asks itself "what character set do I want", and then replies to itself "ansi". And that's it.
 
add a few ms delay between keypresses, and you could have AC write the entire macro for you ;-)
 
3:12 AM
I still like the idea of eating the keypress and triggering an immediate code inspection if they ever type Call.
Make it modal too.
 
@Comintern Rubberduck.VBEditor.WindowsApi.CodePaneSubclass.cs
 
@Comintern and an "Are you sure?" confirmation
 
//Stub for code pane replacement.  :-)
 
Yeah, kind of like the auto syntax check.
@MathieuGuindon Oh yeah. That's the infrastructure for taking over the message pump.
 
that's what AC is using
 
3:15 AM
That's exactly what it's there for.
Is it still configured to auto-subclass everything?
 
I think so
 
I might take another look at that code. Isn't there an open issue with pre-existing windows not attaching?
 
I seem to recall something about the VBE recycling it's hWnds.
OK, I really need to unf*ck my build environment.
 
> Fixes the off-by-one bug that sends everything up in flames when you type this: Call Anything( So the good news is that it's fixed. The "bad" news... is that when parenthesis autocompletion is enabled, Call statement is special-cased and stripped - because the lovely VBE is being "helpful" and instantly removes empty parentheses in Call Something(), leaving the ( key appear to do exactly nothing. Short of preventing the VBE from "prettifying" the replaced line, stripping the explicit...
Call statement is really the only thing AC could do. See it in action
 
3:22 AM
ah, crap.. I made my branch with git checkout upstream/next -b rdnext, and now VS' Team Explorer thinks git push goes upstream and isn't letting me
git push origin works fine
how do I fix this?
(the half-rewritten AC is in my next - yes, I'm this dumb)
 
Create a new clone of origin/next, then set that as your upstream and merge just the branch into it?
 
really?
 
I think you can do that.
@Hosch250 might have a better idea. He's always been the git guru.
 
nah, @Vogel612 is :)
(is... well asleep at this time)
 
I think you lose the history that it branched that way, but if you clone and then swap the config with the branch on the filesystem, in theory you should be able to just commit it.
The intermediary commits get lost though. I'm not sure what happens when you merge it back into your "real" next.
 
3:31 AM
yeah that's the thing... I don't want to lose the work I already put in getting AC testable :)
thank God you can't name a member "Call"
(stress-testing the PR)
I wish I could inject a tooltip at the caret position
 
What about an enum or type member?
 
then it wouldn't be followed by an identifier and then a (, no?
foo.Call MsgBox( -> MsgBox
 
> # [Codecov](https://codecov.io/gh/rubberduck-vba/Rubberduck/pull/4177?src=pr&el=h1) Report
> Merging [#4177](https://codecov.io/gh/rubberduck-vba/Rubberduck/pull/4177?src=pr&el=desc) into [next](https://codecov.io/gh/rubberduck-vba/Rubberduck/commit/abe03b04767868cce2672bff8c9289d0e1bbf2ad?src=pr&el=desc) will **decrease** coverage by `0.02%`.
> The diff coverage is `0%`.


```diff
@@ Coverage Diff @@
## next #4177 +/- ##
===========================
[rubberduck-vba/Rubberduck] build for commit 798c6b45 on unknown branch: 52.46% (target 0%)
[rubberduck-vba/Rubberduck] build for commit 798c6b45 on unknown branch: AppVeyor build succeeded
 
Probably not. I'll try and break it after I'm synched.
BTW, I forgot this bit:
        //This is an output window firehose, leave this here, but comment it out when done.
        //if (idObject != (int)ObjId.Cursor) { Debug.WriteLine("Hwnd: {0:X4} - EventType {1:X4}, idObject {2}, idChild {3}", (int)hwnd, eventType, idObject, idChild); }
It's useful as hell for debugging the message pump.
 
3:54 AM
lol there's a #partylikeits1998 hashtag trending on twitter
 
Does @Folder work atm?
I'm a little behind latest, but can't create folders
 
@ThunderFrame works here
 
Huh. I apparently mis-remembered how that was wired up. We only call VBENativeServices.AttachWindow in response to a WinEvent.ObjectCreate. Apparently existing windows were never subclassed.
 
(latest+#4177)
 
I think the only thing that needs to happen is to enumerate the child windows on startup.
 
3:56 AM
yeah, me too
 
@Comintern you need the floating ones too
 
I'm curious if that would work in a static constructor for VBENativeServices...
 
wouldn't we rather want to have full control over the timing of the thing?
 
That wouldn't be deterministic, but the first call on the class is always going to be attaching the event handlers to the VBE, and that's about the perfect time to run the ctor.
 
VBENativeServices is likely getting created while the splash screen is shown
hmm
 
3:59 AM
We're creating the event handlers that early in the load process?
 
no, I don't think
but I'd explicitly do it near where it's happening
 
Although actually, I don't think that lazy initialization of statics is to spec.
 
I suppose, in App.cs
 
In theory the CLR could run it before anything. I just doesn't. So maybe not the best plan.
 
4:00 AM
[rubberduck-vba/Rubberduck] retailcoder pushed commit 798c6b45 to next: fixes #4141, closes #4154
Merge pull request #4177 from retailcoder/rdnext

Critical AC fixes
 
@MathieuGuindon damn - had an extra blank line between Option Explicit and @Folder foo so the annotation was above the Sub Foo. Removed the blank line, the annotation was treated as being in the declarations section, and then it worked. I thought you fixed that?
 
associating annotations to procedures is borked
 
I'll just put it in HookEvents. Everything checks to see if it's stored in TrackedWindows already, so that should be a relatively simple fix.
 
seems the annotation is still only recognized if it's in the declarations section. The parser doesn't scan until the first Sub/Function/Property declaration statement, so comments above the statement can be treated as belonging to the procedure, and not to the declarations section
 
4:07 AM
@ThunderFrame Are the dockables the only ones that aren't under the child window tree of the VBE main window?
 
"Bad news": because the VBE will "helpfully" turn 'Call Foo()' into 'Call Foo', parenthesis completion can't work for a 'Call' statement, so it's special-cased. Type this: 'call msgbox(' Get this: 'MsgBox|' Just type the " (no need for space!) to resume (i.e. to get 'MsgBox "|"')
Good news: Autocompletion critical bugfix coming up.
Here's a link to a 9-second video showing the surprising new behavior in question: https://www.dropbox.com/s/i6hwqapja5aicew/RD%20AC%20-%20CallStmt.mp4?dl=0
I realize this is surprising behavior that's completely not ideal, and I apologize to all the hardcore fans of the explicit 'Call' statement. But if you had to choose between tripling your productivity with AC, or using obsolete 'Call' statements... I mean, right?
 
I guess I could stub that part for later, but ATM we only attach to codepanes and designer windows.
 
@Comintern IIRC, there are 3 places to look. Child docked windows, Child windows that are undocked/MDI children, and windows that are floating (and floating windows can have a hierarchy too)
and maybe hidden windows also behave differently
 
@TweetingDuck that is not the order they were threaded in...
 
The dockable windows are parentless IIR, but I'm pretty sure anything in the Windows collection will always be in the VBE main windows child hierarchy.
I'll make sure to play around with both docked and undocked windows.
 
4:11 AM
@TweetingDuck make the RD settings let you choose between: AC disabled for Call, AC enabled for Call, whereby typing Call will have the keyword removed, and a giant fish emerge from the monitor, to slap you in the face.
 
We currently catch our docked windows explicitly - IIR the dockable window host inherits from the subclasswindow.
 
@Comintern There's a difference between docked and undocked, but if a window is made undockable, it becomes an MDI child. Currently, making an RD ToolWindow undockable makes it so that you can't make it dockable again without either killing the host before it saves, or obliterating your Dock registry key
 
[rubberduck-vba/Rubberduck] build for commit ab68630a on next: AppVeyor build succeeded
[rubberduck-vba/Rubberduck] build for commit ab68630a on next: 52.46% (target 0%)
 
If you're poking around in the windows, it would be great if you could discover a way to rearrange them programmatically.
 
4:15 AM
@ThunderFrame I think the MdiChildHack window is responsible for maintaining that relationship. I should play around with that too.
@ThunderFrame Rearrange where? Like where they're docked, or the MDI order?
 
@ThunderFrame hmm, alternatively I could simply skip AC given a Call statement. You want to #partylikeits1998, you stay in 1998.
but Call was already obsolete in 1998
 
We could just start a FUD campaign about how using Call is dangerous and unstable. Then leave the crashy behavior as is.
 
@Comintern where they're docked and/or where they're floating.
 
I remember trying that once. I could never figure out how the registry key was coded.
 
Right now, on first use, RD just floats the window. There's an issue somewhere for being able to have finer control over which window they're docked to, so we could create various workspaces. One say, optimized for debugging, and another, optimized for inspections.
@Comintern I've worked out the key, but IIUC, the key is only read on startup and written on shutdown. There's no way to have the key read when you want to change the layout, unless you restart the host.
 
4:21 AM
meh... I'd rather work on Avalon than anything that attempts to improve the doomed inspection results toolwindow
 
I still want to own the immediate window.
 
then you need to own the debugger, no?
 
Yes. I've pretty much come to the conclusion that it's a glorified terminal.
The debugger uses it kind of like stdin and stdout.
 
@Comintern that has its own project, we now know
 
IIUC it's literally an ITypeLib, kind of like an embedded project inside the project
 
4:23 AM
The problem that I was running into is that there's not really a good way to detach another debugger unless you own its handle.
Visual Studio can't even do that.
 
googles 'how to tell Windows to STFU and let me write to any memory address and not explode'
 
They keep throwing up roadblocks to that. Not all access is strictly a "violation".
:whistles innocently:
 
well, we're in-process, so...
 
OK, that's a lie. I do want to violate the Immediate Window.
3
 
calling it a day here
'night folks!
 
4:31 AM
Night.
...and still no unit tests. Note to self - never install a beta .NET Core toolset.
 
4:53 AM
Does the build process set RD to load on startup? I can't seem to get the setting to stick.
Ah, I know how I can test it - assert into the VBE instead of opening it manually.
 
 
4 hours later…
8:40 AM
@MathieuGuindon git push origin branch -u
U is short for set-upstream-to
There should also be unset-upstream
 
9:14 AM
@MathieuGuindon The R# test runner works just fine since I removed the Deployment attribute.
 
 
3 hours later…
12:29 PM
@Comintern FWIW: you can get to the Immediate's VBA project using type lib API. We have yet to try whether that lets you write code to the immediate window or whatever.
 
@this I'm assuming I can just search it in chat?
 
uh, Wayne mentioned it only in passing.
Jan 18 at 16:48, by WaynePhillipsEA
Coming to a rubberduck near you soon... live ITypeLib support from the VBE, including reading and writing the conditional compilation arguments plus determine the types of objects (workbook/worksheet/form/report etc), and controls.
hmm, bummer it was a link on his website
and it's already gone
 
Unfortunately my immediate problem looks like Visual Studio sorted out.
 
1:05 PM
@MathieuGuindon Yes, because it set the remote on that branch.
So, you need to either unset the remote and push normally, or change the remote to a different branch.
584
Q: How to remove remote origin from Git repo

2619I just did git init to initialize my folder as git repo and then added a remote repository using git remote add origin url. Now I want to remove this git remote add origin and add a new repository git remote add origin new-url. How can I do it?

Ah ha, Vogel beat me to it.
 
1:49 PM
@IvenBach it is a good video. there are things in there that I forget so I need to watch it again as well. I only made it half way through yesterday
 
2:04 PM
@Comintern, some background material that Wayne has contributed via chat, that has either already been implemented, or should be. I may have missed a few, but SEchat search functionality is not as powerful as it could be. Thought you might find them interesting:
On getting the ITypeLib (despite the message saying ITypeInfo) from the References Object
On getting the ITypeLib (including protected projects) from the Project Explorer
On accessing the identifier pointers and table
On switching to the vTable based interface
On accessing IPeristStorage and getting the raw source code of a module, including attributes, without exporting to disk
 
@ThunderFrame Perfect - thanks for tracking those down.
 
@Comintern took me 5 minutes. I hate to think how long it took Wayne to discover it all.
 
True that.
 
2:28 PM
and just in case @Comintern didn't see it already there's a project: github.com/rubberduck-vba/Rubberduck/projects/15
 
@Malachi @IvenBach - video on Git? Would one of you repost the link? I can use all the help I can get...
 
2:58 PM
@FreeMan No, on Excel. Follow the chain, if you aren't on mobile.
 
ah, thanks!
I get the purpose of using Right$() to avoid the implicit type conversions. What was the point of creating Right() with the implicit type conversion, and is there a time when one might actually, intentionally, want to use it?
 
@FreeMan if there is, I don't know what it is. if anything we should hijack _B_VAR_RIGHT calls and redirect them to _B_STR_RIGHT
 
@FreeMan I would say it's primarily for interoperability.
 
@this with what?
 
3:11 PM
As an example, a control's Value is usually Variant
Therefore, myLameTextBox.Value = Right("foo") would be more inline with what you are storing (a Variant data type).
 
so? you get the implicit conversion inside the function rather than at the call site, no?
 
Yes, I still would use the $ anyway myself.
 
(or rather, inside the Value mutator)
 
I know for sure that it's not available inside context of an Access query but that's not really the same thing as doing it in within VBA.
 
which? Right$?
 
3:13 PM
I'm also thinking about the case where you can get ByRef mismatch error.
oh you can do this in Access query: SELECT DoNotThis FROM AtHome WHERE That = Right("foo", 1);
but Right$ won't work there.
 
right but then that's Access-SQL, not VBA
 
Correct - even though it's capable of using VBA to evaluate expressions. Same problem w/ Excel formulas.
Hmm, is there a way to get a byref mismatch error when the expected data type is a variant?
 
what's a byref mismatch error?
 
oh you know when you have something like Public Function Foo(ByRef bar As String)
and you try to pass in Foo someVariant
in that case, implicit conversion won't happen and you get a error
 
I only ever recall seeing that error with arrays
 
3:17 PM
i do see that more often in the immediate window
since i'm going to be v = "foo": ?Foo(v)
 
why can't I have a refactor/rename @variable in SSMS?
 
Ctrl-h
:)
 
confirmed a MCVE:
Public Sub foo(bar As String)
    Debug.Print bar
End Sub
in immediate: v = "bar": foo v
 
@this same here
 
3:24 PM
What I am not sure is if one could ever get a byref mismatch error for a Variant
 
Sub test(ByRef bar As String)
    Debug.Print bar
End Sub

Sub t(ByVal v As Variant)
    test v
End Sub
sheet1.t "bar" -> byref arg type mismatch
 
Right.
 
@Malachi thanks
 
yw
 
So in those use cases, you might need to use the variant returning types rather than string-typed alias. At least that's what I thought why we default to using variant-typed functions.
 
3:30 PM
So, if you're writing good, strongly-typed code, you have to think long and hard to contrive an example of when you'd want to use the variant-typed functions. i.e. they're there as a crutch for those who don't write good code because VBA makes it so easy to do so
 
Basically, yes.
 
well, it's good to get that cleared up!
:)
 
The original idea was to "not worry about data types, just get on with what you are trying to solve"
which is all good and well until you start writing nonsense like 1 + "1"
or even #5/3/80# - 3.25
 
which created a generation of poor coders who really weren't coders, and really, that created the entire demand for SO, so, I guess, it's good in the long run.
/always looking for the silver lining
 
According to Edgsar, I should never be a coder, so....
 
3:32 PM
meh, what's he know, anyway...
Googles "Edgsar". Gets no satisfaction.
 
> I think of the company advertising "Thought Processors" or the college pretending that learning BASIC suffices or at least helps, whereas the teaching of BASIC should be rated as a criminal offence: it mutilates the mind beyond recovery.
oh also this gem:
> It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration.
 
The subtle difference between Edgsar and Edsgar
also:
> FORTRAN's tragic fate has been its wide acceptance, mentally chaining thousands and thousands of programmers to our past mistakes.
 
I speel gooder, ok?
 
otay
> I mean, if 10 years from now, when you are doing something quick and dirty, you suddenly visualize that I am looking over your shoulders and say to yourself "Dijkstra would not have liked this", well, that would be enough immortality for me.
 
00:00 - 16:0016:00 - 00:00

« first day (1498 days earlier)      last day (1682 days later) »