« first day (1418 days earlier)      last day (1762 days later) » 

8:03 PM
Reading about variants in bytecomb.com/vba-internals-whats-in-a-variable, specifically the Description part.
> There is a special type of Variant, too: a ByRef Variant. ByRef Variants are only created by the runtime when a non-Variant variable is passed as a method parameter that was declared ByRef as a Variant type. In this case, the VARENUM value at the start of the variant will include the VT_BYREF flag (0x4000), and the content of the variant will always be a pointer. The pointer points to another VBA variable; it is the exact same pointer as returned by calling VarPtr on that source variable.
> When a variant refers to another variant by using the VT_VARIANT | VT_BYREF vartype, the variant being referred to cannot also be of type VT_VARIANT | VT_BYREF. VARIANTs can be passed by value, even if VARIANTARGs cannot.
 
"what is the most fundamental advice when it comes to writing?"
 
The part I'm stumbling on is when you have a chain of several method calls that are variant.
 
Use the pointy end of the pen/pencil/quill — xDaizu 4 hours ago
@IvenBach RD's resolver also has a problem with those :)
 
From what I've read it can/should only be able to go down 1 level.
Sub GoesPastSingleLevel()
    Dim imNotAVariant As Long
    Foo imNotAVariant
End Sub

Sub Foo(ByVal value As Variant)
     Bar value
End Sub

Sub Bar(ByVal value As Variant)
    Duk value
End Sub

Sub Duk(ByVal value As Variant)
    Deep value
End Sub

Sub Deep(ByVal value As Variant)
    Debug.Print value
End Sub
 
Is it a known issue that the Move closer to use refactor doesn't trigger either the procedure formatter or a reparse?
 
8:08 PM
@FreeMan not sure. IIRC that refactoring was tweaked recently... make a new issue?
@IvenBach what's the problem?
output the params/args pointers with Debug.Print VarPtr
 
I checked them and got 2422160, 2421964, 2421784, 2421604, 2421424 for each level/call.
 
> It does not trigger a reparse and it does not execute the indenter on the changed method.

```vba
Private Sub DeleteExtraLogFiles(ByVal filePath As String, ByVal fileNamePattern As String, ByVal maxLogsToKeep As Long)

'move this vvv
Dim oldestFile As String

On Error GoTo ErrorHandler

Dim fileCount As Long

Dim currentFile As String
currentFile = Dir(filePath & fileNamePattern)

Dim oldestFileDate As Date
oldestFileDate = #12/31/3999#

Dim currentF
 
@MathieuGuindon done
 
thanks!
 
@IvenBach I think it's irrelevant because a ByRef would be just be re-marshaled. Besides, I don't think you can make a VT_VARIANT | VT_BYREF from VBA code alone.
 
8:21 PM
I've not understood properly then.
 
I like how every single element of the solution was right here in this comment thread over an hour ago. For the record, unchecking that box changes absolutely nothing about the file's structure, only how Notepad represents the data in the file. A file is not its data, data is not a file, and whether you open a file in Notepad, Wordpad, Notepad++, or by coding it in VBA, the file's content is always the same regardless. Also for the record, you shouldn't be hard-coding file handles like this. Use the FreeFile function to let VBA give you a usable file handle instead. — Mathieu Guindon 8 secs ago
now I can sleep tonight
hmm, we haven't implemented the FreeFile inspection yet, have we?
 
I'm rereading, Ivne
 
ah, here - #1856
 
OK, i'm thinking wrong, @IvenBach.
 
welp
 
I really do not have the time or interest to get chummy with the XAML UI.
soo ... CodeMetrics UI is [up-for-grabs]
I can adjust the behaviour of the "backend" if anyone requests it, but I will not put work into the UI there
 
@Vogel612 that's fair game :)
this thing is collaborative for a reason!
 
yea I unsuccessfully tried to coax both Iven and Hosch into doing the UI
 
Your sample is not right because you used ByVal and the issue is w/ ByRef
and from what I read, it is not really possible to create a VT_VARIANT | VT_BYREF from a Variant data type
The only way to do this is something like Dim foo As Long and then Public Sub bar(baz As Variant) and then calling it bar foo.
In this case, the baz would be VT_VARIANT | VT_BYREF
 
8:36 PM
or Sub bar(baz) for implicit accessibility, byref, and parameter type
 
since it now points to the foo variable.
 
correct
 
I do not think VarPtr will help you there - the pointer to the foo is likely hidden in the VARIANT struct.
e.g. the pvData contains the value of VarPtr(foo)
 
if you Debug.Print VarPtr(foo) before calling bar, and then inside bar you do Debug.Print VarPtr(baz), I'm expecting the debug pane to contain twice the same value (assuming baz is variant and ByRef)
 
8:37 PM
Try what Mat said. See if I'm wrong.
I don't expect it to be so but it won't be my last time I'm wrong.
 
> Upon further usage, it appears that manually triggering the indenter causes a reparse, so as I see it, a simple call to the indenter for the affected method should take care of both stones with one bird.
 
@this no, you're right
thisworkbook.Test
 3273520
 3273500
Sub Test()
    Dim foo As Long
    foo = 42
    Debug.Print VarPtr(foo)
    DoSomething foo
End Sub

Sub DoSomething(ByRef bar As Variant)
    Debug.Print VarPtr(bar)
End Sub
 
NOW - to your other point about multiple method calls, what I expect (and I can be wrong), passing it byref to yet another method that takes Variant has no change - it'll be still be the same as the 2nd variant
 
and then change As Long to As Variant
thisworkbook.Test
 3273508
 3273508
 
do a 3rd method called by DoSomething and pass the bar in into another ByRef Variant. What's the address inside the 3rd method?
 
8:42 PM
expecting it to remain the same
 
so do I
it should be same as the bar's address
 
thisworkbook.Test
 3273508
 3273508
 3273508
Sub Test()
    Dim foo As Variant
    foo = 42
    Debug.Print VarPtr(foo)
    DoSomething foo
End Sub

Sub DoSomething(ByRef bar As Variant)
    Debug.Print VarPtr(bar)
    DoSomethingElse bar
End Sub

Sub DoSomethingElse(ByRef baz As Variant)
    Debug.Print VarPtr(baz)
End Sub
 
?
 
Sub Test()
    Dim foo As Long
    foo = 42
    Debug.Print VarPtr(foo)
    DoSomething foo
End Sub

Sub DoSomething(ByRef bar As Variant)
    Debug.Print VarPtr(bar)
    DoSomethingElse bar
End Sub

Sub DoSomethingElse(ByRef baz As Variant)
    Debug.Print VarPtr(baz)
End Sub
thisworkbook.Test
 3273520
 3273500
 3273500
makes total sense
520 is a Long local to Test; 500 is a Variant being passed around by reference, that only starts existing in DoSomething
 
yeah that's what I was expecting
(forgot to change back to Variant)
 
8:45 PM
@this seems you missed the As Variant
 
Right, so there's no mulitple redirection and thus the spec isn't violated
Yes, that's why I was ? earlier there, should be As Long
 
and I do not think it is possible to create a VT_VARIANT | VT_BYREF variant directly in VBA
so as such, it is not possible to violate the limitation using VBA.
directly meaning doing something like Dim v As Variant : x = ByRef y (not legal)
 
wouldn't make much sense... VT_BYREF implies you're passing something as a parameter, no
yeah
 
of course, @IvenBach if you really want to, you can just Declare the C++ methods and do it yourself...
 
8:48 PM
I'm just getting back to when you and mug were checking it out.
Work gets in the way of me learning stuff.
 
#NerdSniped
4
 
@Vogel612 I've no UI experience and would be drowning if I tried.
 
@IvenBach but you'd probably have the drive and would ask the right questions
 
as heretical as it may be, I'm not exactly impressed with XAML. It assumes way too much from the user and is way more convoluted than it should be.
 
I'll stop harping about it though, it's your decision :)
 
8:53 PM
I need to tackle the About control before anything else.
 
@this I ♥ XAML
 
It's not harping, not to me at least.
 
@IvenBach yup. start with the about box.
 
I need to make the time for it. I'll never learn C# unless I force myself to work on new and scary stuff.
 
my feeling is that if I have to google for every small change I need to do with XAML and look at 10 SO threads before I find the right syntax..... something went wrong.
 
8:54 PM
there's a bit of that
but a big part of that is getting the whole UI to work without writing any (or as little as possible) actual C# code-behind
then again, hacking it up in C# in the code-behind raises more WTF's
 
Don't misunderstand me I totally support the idea of doing it declaratively. I'm a db guy remember? ;-)
 
@this Not sure how to do that.
 
that's part of the problem, possibly 5 of the SO threads probably show how to do it in C# code-behind. :\
@IvenBach no different from using API. Just stick in few declare.
 
@this that pretty cleanly maps to XAML, though.
 
Unless they're class methods.
 
8:57 PM
it's similar to JavaFX that way
 
Hmm. News to me. So I can take any C# code and reverse-engineer to XAML?
doesn't feel right
 
not quite any, but most of the layouting and "add this to that" stuff
the tagnames directly correspond to the classnames,
 
Still feel like more work than it should be.
Yeah that I already observed
 
simple Properties (string, primitives, enums) are usually attributes on the tags, complex properties are subelements
 
yes but see, I ain't going to have the time to memorize 100000000000000s of properties, classes, and all that crap
 
9:00 PM
that's why there's SO
 
wrong answer
 
pffft. damn right
if you do XAML UI's every day of the week, at one point you don't need SO anymore
it's when you do XAML once every 4 months that you forget things
 
2
Q: Pruning logs, burning the remains

FreeManAfter implementing some logging in my system, I got tired of digging through very long files trying to determine where specific runs started/stopped to look for differences, so I began adding a date/time stamp to the file name so I'd get a new log file each time the processing kicked off. This wa...

 
@QuackExchange lol
 
granted, but geez what a cliff to climb.
ideally a great framework ought to be a gently sloping hill
 
9:02 PM
it is known, that WPF isn't for the faint of heart
 
@MathieuGuindon Now the truth comes out.
 
steep and bloody, that hill is
 
yeah. this is a big challenge in any framework design. Too many I see either railroaded framework which can be only toys forever or Enterprise™® framework that requires 5 phds and 1000 engineers to just have a working implementation.
.NET framework is pretty damn impressive in that regards, I think. XAML..... Sorry, it failed.
 
XAML is pretty good for what it does
it's somewhat arcane, because XML is so much more than just a few tags
but it's significantly mightier than JavaFX and JSF (the other XML based UIs I know)
 
9:11 PM
I hardly think it'd fared better were it JSON.
 
because it embraces the power of XML
 
@puzzlepiece87 @FreeMan I'm not sure if you got the idea of reference types but I found a great explanation of it
 
@this no of course not. JSON doesn't pack the punch of XML
 
> A reference is an indirect way to refer to something. The title of a book or the postal address of a building are references. They allow us to refer to big or complicated chunks of information with a small shorthand label. I can refer to the book “Moby Dick” just by those 9 characters; I don’t have to recite the entire contents of the book.
 
besides JSON is more geared for data transfer
 
9:12 PM
JSON is just primitives with names, lists and the option of nesting
 
but anyway my point is I don't think it's really XML per se that's holding XAML back.
 
XML is basically a full-fledged programming language
 
markup language. ;)
 
@this I didn't mean to imply that XML held XAML back
 
markup ≠ programming
 
9:13 PM
@this that's an incredible misnomer
 
so it's "eXtensible Mashmosh Language" then?
 
which markup language supports namespaces, arbitrary recursion and references?
that's nicely down into programming territory
 
@Vogel612 OK but I am thinking the arcane comes more from the fact that there's way too many things to do with XAML rather than the choice of language to represent the XAML.
 
yes, but those issues are both related and separate
the problem is that a "simpler" structure would not have been able to adequately represent what WPF required to be an improvement beyond JavaFX
 
@Vogel612 hmm not sure I follow how those make it a "programming" language. A programming language is something that can be compile into something that run instructions. A "markup" language makes no such promise. All it is is that it tells what that and this is but it's entirely up to you to interpret what that and this means to you.
 
9:18 PM
I intended to mean turing-complete
html is not turing complete
 
I wrote the blog post as a would-be answer to this off-topic question. Tonight's post will be specifically about this discussion though. I took offense at "anti-pattern", because I use that term to describe things like "Smart UI" and "Service Locator", both things that are poisonous in any decent code base, whereas after using this in every class of mine for several years I've found that it makes my code feel exactly right every time. I've yet to hear a real argument against it. "does not behave well in collections" is irrelevant, and it's not hidden in the locals, just collapsed. — Mathieu Guindon 1 min ago
 
xml is getting close enough to being that it doesn't make much of a difference anymore
 
Hmm. Really never thought of XML as turing complete.
Meh, I suppose if you wrote a compiler that eats XML.....
but still XML is meant to not convey what data means; it only describes what the data is.
at least that's how I think of it.
 
sure. most of the time that's the case, too
 
ugh. a deleted comment. now I miss my mod goggles
 
9:22 PM
fwiw that comment was pure chatter.
want me to move it to chat for you?
 
aaand same comment made again ...
 
I spend most of my day being nerd-sniped.
 
> rather than historical material that might already have anyway to support your comments here
 
9:23 PM
If I'm not nerd-sniped once a day, it's been a bad day.
 
I came up with something, and now you blame me for being my own historical source
2
 
@QuackExchange @FreeMan FSO >>>> Dir
2
 
@IvenBach FYI, I've got some crappy code in my checkers website. Want to take a crack at reviewing it?
It's way too bad to put on CR ATM, so sorry, but you can write a document up and email me.
It'll be a great learning opportunity.
 
@Hosch250 you lazy bum, put it up on CR! #NoShame
 
@MathieuGuindon It is going up on CR once I finish the last 2-3 features and get some of it sorted out.
It's not really complex, just not organized nice.
 
9:27 PM
@Hosch250 It's in VBA right?
 
Like, multiple types in the same file, etc.
@IvenBach Of course.
 
@Hosch250 said the boy who didn't know VBA
 
@MathieuGuindon Same here, but I'm staying for a bit longer.
 
Sure. Email me a link and I'll see about reviewing it.
 
@Hosch250 C# I'm guessing.
 
C# with ASP.NET MVC.
So there's a bit of HTML/CSS/TS.
 
@IvenBach bring your own the tomato sauce, though.
 
You can ignore that, but feel free to look at the .cshtml files.
 
> Sounds good. Perhaps a performance benchmark of some form (thinking perhaps in minutes manually closing all inspections within one project) can be made before changing to a module filter so a comparison be realised.
 
9:35 PM
@M.Doerner a while back you requested changes on the resolver PR - I think I've addressed (albeit not in exact way you asked for originally) - would appreciate a confirmation that you're satisfied with the revisions I did.
 
I will have a look tomorrow.
 
cool. later.
 
Some thoughts I found reading a,one my links from our last nights conversation @Hosch250 age-of-product.com/product-backlog-defense
 
10:01 PM
Sub PointerExamples()

    Dim lLong As Long
    lLong = 42

    Dim sString As String
    sString = "hello"

    Dim oCollection As Collection
    Set oCollection = New Collection

    Dim aDoubles(10) As Double
    aDoubles(0) = 3.1415926535

    Dim aObject(10) As Object
    Set aObject(0) = CreateObject("Scripting.Dictionary")

    Dim vDate As Variant
    vDate = Now

    Dim ptrToLong As LongPtr
    ptrToLong = VarPtr(lLong)

    Dim ptrToStringVar As LongPtr
    ptrToStringVar = VarPtr(sString)
I'm noticing that ptrToBSTR, ptrToObject, ptrToArrayData, and ptrToArrayObject all have a much higher memory address number.
Is this an example of stack vs heap and where things are stored?
 
10:15 PM
could be, yes
or more precisely: most likely that's exactly what happens
for compiled languages there is no guarantee that objects are allocated on the heap
because the compiler can sometimes prove the lifetime of an object does not exceed the lifetime of the stackframe and additionally allocating on the stack can give a performance boost because of hot memory
and the compiler thus chooses to allocate the object on the stack
 
Reading about the stack from blogs.msdn.microsoft.com/ericlippert/2009/05/04/… has allowed me to understand what you just said.
In laymans terms if an objects lifetime is confined to a Sub/Function then it can be put on the stack.
There's no need to put it on a slower access and you'll get only benefits of putting it on the stack.
:click: An orphaned object now makes sense!
 
10:30 PM
@IvenBach exactly, the problem is that this is not generally provable
 
Why is that though?
 
because recursion and halting problem
 
@IvenBach where "sub/function" is a finite scope, yes. In C# though you define a scope with curly braces, so a scope is not necessarily a whole procedure.
 
This problem doesn't exist with VBA or does it?
 
can you prove that an object you pass to a WinAPI is not going to remain reachable from outside of the stackframe?
 
10:33 PM
That the WinAPI isn't going to hold onto that reference? If that's what you're asking then no.
 
@Vogel612 no but I can probably prove that a variable in a using scope will be pretty damn tight, no?
(assuming it's not copied anywhere)
anyway, driving
 
but can you prove it's not copied?
 
@MathieuGuindon Ohhh... naughty
 
that's what this boils down to: as long as you can have global state, you're basically limited to heuristics and callgraphs
@MathieuGuindon the only guarantee a using block gives is that Dispose is called on the instance it captures when the execution context leaves the block in any way
 
10:53 PM
a bit bright, but the palette is quite saturated...
 
these look awesome
 
thanks!
 
What is that?
 
Rubberduck Refactorings menu in VB6 IDE
 
I that the Avalon the stuff I don't understand but that's going to make RD even more awesomer?
 
10:55 PM
nope, "just" VB6 IDE support
 
I don't get the "just" part.
 
because just is a horrifyingly strong understatement
 
@mansellan That's what I was mistaking for the Avalon stuff.
I lack the understanding to fully appreciate getting RD to work in VB6.
 
VB6 is not bound to office
 
in two minds as to whether to PR now, or do the clipboard-hooking first
 
10:57 PM
@Vogel612 I'm derping hard... As in VB6 is fully independent of Microsoft Office?
 
well, other than that it uses Office 8 command bars for its menus and toolbars
but yeah, VB6 doesn't need Office installed at all
 
VBA is a "fork" of VB6
 
or - VB6 is a VBA that you can create executable programs with
:-)
 
@Vogel612 right
 
@mansellan Neato!
Now I can appreciate what that means.
 
11:00 PM
@mansellan that's BEAUTIFUL!!
 
I think the icons won't work in locales other than en until the clipboard is hooked...
need to watch what VB6 asks for from the clipboard
4bpp art :-)
@MathieuGuindon should I PR? or wait till the hooking is done?
 
@Vogel612 A using block only guarantees that Dispose gets called on the captured instance when the execution context exits the block in a way for which finally blocks get executed.
 
@M.Doerner huh?
 
You can kill the thread without the dispose ever happening.
 
11:04 PM
ohhh right.. threads...
 
There are some other circumstances in which this happend.
 
@Vogel612 an "adventure in windows world"
 
I vaguely remember something about AppDomain getting unloaded.
 
with that I shall go to bed
Toodles!
 
night
 
11:08 PM
gn
 
night!
 
Umm.@this when was the discussion of XAML brought to your attention for RD ? As I’m reading your views about the framework, was not sure if your views represented a problem to solve or a case of future direction with Matt’s conversation. Just wanting to join some dots...
 
@rolfl eh, I was merely announcing that I was going to start the engine... what did you think? ;-)
 
Oh found it Matt mentioned he loves XAML...got it.
Well I learnt something about it at least.
 
11:30 PM
2000 views on RD News in April!
(biggest ever!)
 
Still have 6 days left.
@MathieuGuindon How hard is it to get a website up and running? I know that's kind of a loaded question.
 
@IvenBach #ItDepends ;-)
Define "website"?
 
:cough: A place where I can expose my lessened ignorance about VBA/Excel on the interwebs. :cough:
 
A WP blog would do that. The hard part is writing the content!
LMK if/when you want to write on RD News =)
 
I'd like to contribute. Most of mine would be IDE basics like hotkeys. Or a laymans explanation of how to set up a reference.
 
11:38 PM
👍
You know where to find me when you're ready! ;-)
 
:gulp: ok.
#GottaStartSomewhere
 

« first day (1418 days earlier)      last day (1762 days later) »