« first day (2083 days earlier)      last day (97 days later) » 
00:00 - 20:0021:00 - 00:00

12:00 AM
RELOAD!
[Minesweeper] Games Played: 63, Bombs Used: 46, Moves Performed: 9598, New Users: 11
 
anyways if it doesnt marshal as i need then i have to specify using the MarshalAs attribute as i get it
 
RELOAD!
[rubberduck-vba/Rubberduck] 11 issue comments
[Zomis/Server2] 1 issues opened
 
i cant really see from the documentation how that is supposed to be achieved i guess
gonna roll with trying it in vb.net with a test class and seeing what happens
except now writing VB.Net is painfully hard :/
@MathieuGuindon lets just say i think i get what you were saying about how i'd view VB syntax after spending a while working with C# :)
 
except the semi colons of course
 
12:10 AM
@theVBE-it'srightforme sounds like all you need might just be a ParamArrayAttribute? docs.microsoft.com/en-us/dotnet/api/…
 
oml
yes i think so ty
lets try it!
 
Might not be it at all though, the more I read the more it looks like what's underneath params
 
Some languages, such as C#, may even require the use of the language keyword and prohibit the use of ParamArrayAttribute."
yeah
though of course that might be why its not working with the interop?
 
Nice find, @MathieuGuindon
@theVBE-it'srightforme I think that's meant for C# code using that parameter, which isn't the case.
e.g. you need it to be [ParamArray] param foo
 
@theVBE-it'srightforme nah, thinking it has nothing to do with COM interop and I just muddied the waters
 
12:14 AM
yeah C# compiler is throwing a big fit
 
then why is it com visible?
 
[System.Runtime.InteropServices.ComVisible(true)]
public sealed class ParamArrayAttribute : Attribute
 
@this good question
 
"Do not use 'System.ParamArrayAttribute'. Use the 'params' keyword instead."
very strong
 
12:15 AM
aye, the attribute isn't for COM interop at all
sorry
 
yeah C# is not a big fan of that
 
what happens if you just use the param?
 
@M.Doerner found where it's wired up?
 
here is what it shows in object browser
 
Reading the example closely, it is very weird. Why talk about attribute then not use it in the example?
 
12:16 AM
because they can't, it's illegal to use in C#
 
Obviously but what I meant was -- why even talk about a thing that you can't use?
"hey! here's a shiny thing! You can't use it. MWAHAHAHA!"
 
@this because VB.Net is a real language too!
 
lol not all .net languages are C# and VB.NET!
 
No, it simply was not wired up correctly at all.
 
hm, no wonder it felt like magic =)
 
12:18 AM
@MathieuGuindon not all .net languages are big boys like C# and VB.NET!
T, FTFY.
 
Sub ParamAdd(Items() As Integer) is how it appears in the object browser
 
I tested and, contrary to my expectation, I had no items in the clipboard.
 
off of void ParamAdd(params T[] Items); in the C#
 
I just fixed up the places with the incorrect cast.
 
(T is int for the one im using in object browser obviously)
 
12:20 AM
Try adding the Optional attribute to the Items parameters
but I fear it might end up as just Sub ParamAdd(Optional Item() As Integer)
wait wait wait, no no, no no
VBA does not allow strong-typed ParamArray
it must be an array of variants.
 
@this it got the brackets so yes
oh yeah i saw that
 
@theVBE-it'srightforme I assume you meant parentheses. ;-) I realize that's OB we're talking about.
 
@this of course
okay
so if VBA needs variant array
i will try
 
anyway, IDK if [Optional] param object[] x will work.
I kind of doubt it.
 
12:24 AM
lets see
this is a less important feature tbh
being able to add multiple items at once is nice but not essential essential
 
as I said earlier, arrays + interop don't make for best experience.
 
that is quite clear :)
 
what you can do is take an object
 
though of course, you don't really need anything before the + sign
 
@this nah you can't have both optional and paramarray
 
12:25 AM
then you can check whether it's an array or not.
 
so try params of variant instead of the type then have the method validate they match the strong type?
or that
two options = more fun
 
@MathieuGuindon ParamArray is implicitly optional in VBA, right? IDK if C# treats param as optional the same way COM would?
@theVBE-it'srightforme no, not a params of variants. Just an object
thought, I guess you can make it explicit by AddLots(Items() of x)
 
so just object Items?
 
that would be more readable and you still get strong typed. You just lose out the convenience of having one method to do both single add and several adds.
sure, if you'd rather have a single method & a runtime check
#PickYourPoison
 
well i already had them in separate methods so...
okay
params object[] Items is read in as ParamArray Items() As Variant
so that was the issue
i mean vba needing it to be variant
 
12:30 AM
Nice. GTK that it does work.
 
but now to what you said about some design decisions :/
yes
so basically im looking at Add(Item As Integer) + ParamAdd(ParamArray Items() As Variant)
which is potentially going to be confusing bc the type reminder isnt there
otoh the user really should know the data type of the structure they're working with considering they declared it that way, so...
 
yeah, i'd go for AddMultiple(Items() As Integer) TBH
but there's antoher problem...
in Excel, common approach to do arrays is to do something like:
 
foo.AddMulitple(Array(1, 2, 3))
Convenient, right?
 
yes aside from how gross it looks syntactically
 
12:34 AM
But Array() returns an array of Variant....
 
well, how would you get VBA to accept a foo.Add(1, 2, 3), then?
 
i would, uh, have the check myself :)
and the user can know they're supposed to be adding items of the right data type
unless im missing something i dont see how else
 
@this yeah
 
you literally cant get that syntax for an indefinite number of parameters without having paramarray right?
 
12:38 AM
Yeah
or some kind of Array() wrapper like I showed earlier
Excel has a number of that calling syntaxes.
 
it's the worst in PivotTable automation. A lot of methods within that part of Excel OM really wants arrays of whatever
 
you mean i should add that sort of Array() wrapping to what im doing?
 
so you end up doing stuff like pt.PivotFields Array(1, 2, 3), Array(a, b, c), Array(f, g, h)
no no
 
12:41 AM
i'm just commenting that this kind fo calling syntax, fugly as it may be, is common
 
but that also strongly implies you are using Variants for everything
 
Nothing to do with why Application.Run takes 30 parameters by any chance?
 
"let's not worry about types and just pretend the noobs know what they want and if they give us wrong types, we'll just pull our best guess out of our posterior! What could possibly go wrong?"
 
wait lol does Array() return an array of variants because all it is doing is taking a paramarray and converting it to a single array object?
 
12:42 AM
yeah
 
@theVBE-it'srightforme yes
 
should i laugh at that or be proud of myself for figuring it out
 
Laugh, and be proud!
 
@MathieuGuindon TBH, IDK. It might have more to do with decomposing the array into actual parameters for procedures that doesn't take an array.
or could be a security thing (buffer protection)
 
@this seems to be the fundamental principle of VBA design/documentation
anyways, so what im getting is that i basically have a choice between:
 
12:45 AM
VBA: We make it fun for you to shoot your foot out!
 
MultiAdd(Items() As Integer) that is called with MultiAdd Array(1, 2, 3) and requires validating the input
or
MultiAdd(ParamArray Items() As Variant) that is called with MultiAdd 1, 2, 3 and requires validating the input
 
@theVBE-it'srightforme won't work.
 
oh right
it wont right away
 
Remember, Array() returns an array of Variants. You can't assign that to an array of Integers.
 
yeah yeah
i was skipping that step in my head :/
param array seems to be winning out here tbh
 
12:47 AM
from a VBA user's POV, MultiAdd(Item() As Integer) is very inconvenient.
 
@MathieuGuindon that sounds ideal
Add(Item As Integer) and MultiAdd(ParamArray Items As Variant)seems best then?
 
YOu'd force them to declare a Dim myLameArray() As Integer, then assign them one by one before passing it into your MultiAdd()
I think so.
 
yeah that is awful
ok ty. that is good too because it is the lowest effort for me
i mean, that is the current state of the source code
 
here's another awful idea.
 
is MultiAdd a better name than ParamAdd you think?
@this all ears
 
12:49 AM
Add(1).(2).(3)
 
@this I am imagining a trollface
 
I did say it was awful. :)
but i think that would work
 
but I think the VBA coder will go "WTF?"
 
i would also go wtf as i dont think i know how to implement that
in the C#
 
12:50 AM
oh that's easy
IAdding Add(T Item)
 
where IAdding is an interface with only one method, Add(T Item)
which is also the default member
 
oh loool
well that is funny enough im tempted to add it
but probably not worth the effort right now
 
just fYI - that's me abusing the builder pattern
 
that was a pattern i did not understand very well
 
12:52 AM
Add(1).Add(2).Add(3) would be marginally better but still is very WTF-worthy
 
so the Add(T item) implementation adds the item to the list or set or w/e and then returns itself?
so that the adds can be chained?
 
yep
 
that is amazing
but also awful design :(
 
yeah.
 
i did add it to my code as a joke though
the majesty must be appreciated
wait the interface has to be IAdding<T> tho
also the return statement
what is the syntax there lol
[DefaultMember("MultiAdd")]
    public interface IAdding <T>{
        IAdding<T> MultiAdd(T Item); }
oh wait lol, i think im doing it wrong
the wrapper class has to implement that interface right?
then it can return itself through the view of that interface
and keep chaining the adds
ill comment this out for now and save it for when im bored more desperate to procrastinate than i am now
 
1:05 AM
@theVBE-it'srightforme Builder isn't a very common or particularly useful pattern - it does make pretty cool, fluent code. The trick is that all builder methods except Build (it returns your IThing) return this (C#) / Me (VB*)
 
"isn't...particularly useful pattern - it does make pretty cool, fluent code." <- can't reconcile that :3
 
@MathieuGuindon is Add the Build in @this example?
i actually never read that blog post lol
no wonder i didnt get it
 
enjoy!
older than your subscription?
 
@MathieuGuindon wrong chat?
oh interesting
the param array shows up correctly but it still throws an error that the automation type is not supported in VBA :/
this is going to be fun
i think i need a break lol
bbl
and ty for all the help as always
unless something else very stupid comes up this should be actually shareable tomorrow :)
something im excited for and also dreading
 
1:14 AM
@theVBE-it'srightforme oh - I misread "i didnt get it" for "didn't get a notification for that article" lol
 
1:28 AM
 
1:51 AM
@theVBE-it'srightforme not really. The assumption was that you'd never need to actually "build"
e.g. the wrapper would have IAdd Add() which then starts an infinite chain of IAdd returning itself after every Add().
Now having typed that out, that smells because there's no explicit Build to say "I'm done mutating this and ready to work with the real deal."
 
2:10 AM
@Duga 11 more. Inching closer.
 
2:33 AM
@MathieuGuindon oh lol sorry
i meant i didnt get it when i saw it mentioned other places
like once you introduced the concept of design patterns i looked them up
or tried to at least
@this that must be what im noticing when i try to actually implement
anyways back to the param array thing i tried having it marshal explicitly as a ByValArray with the element type of variant but that did not work because it only applies to fields
i imagine VBA is throwing a fit because one little thing is off but i really have no way of knowing easily what it is :/
i wish there was another VBA library written in C# that had a paramarray method somewhere to make it easy
i get structurally how to use a custom marshaller now but i have no idea what that custom marshaller would need to do to make it work
 
@theVBE-it'srightforme OTOH if you can't find any, it could be a sign :)
I can't find anything about exposing params to COM as a ParamArray
at the end of the day, it's just a variant array anyway
thinking ParamArray /params is just a language thing
have a docstring that recommends using the Array function to provide an inline array :)
 
@MathieuGuindon the weird thing is that I didn't find any documentation and kind of half-expected that param object[] wouldn't work across COM but to my surprise, it does.
(at least as reported by @theVBE-it'srightforme, anyway)
That said, VBA/VB6 never had strong-typed ParamArray, so that would be a new feature in C#/VB.NET and thus not directly translatable.
Maybe one can write it as public Add([MarShalAs(UnManagedTypes.SafeArray, typeof(object))] params int[] Items) but that'd just mean you get a Add([Items() As Variant]) in VBA/VB6 -- no compile-time validation.
 
2:54 AM
@this oh, I don't think I ever tried it. I had gathered that it wasn't working though.. :confused:
 
2 hours ago, by the VBE - it's right for me
params object[] Items is read in as ParamArray Items() As Variant
 
oh
well then that's that
 
yeah. Just missing the type safety.
 
meh
#goodenough
 
 
1 hour later…
4:17 AM
its not working, no @this @MathieuGuindon
it shows up correctly
but throws a compile error when I attempt to run the VBA sub
 
5:16 AM
ok so i figured out what the problem is
the marshalling does not work correctly
the same issue happens with VB.Net test class and looking at the IDL for my library showed it was not the same as what it is supposed to look like
[id(0x00000003), vararg]
    HRESULT MultiAdd([in] SAFEARRAY(VARIANT) Items);
correct version
id(0x00000003), vararg]
    HRESULT MultiAdd([in, out] SAFEARRAY(VARIANT)* Items);
how to get the correct version is still up in the air
unless you can easily edit IDL of course :3
knowing this i found enough on the default marshalling documentation to get some leads so ill see where it goes
 
 
3 hours later…
@Duga Better a doubly opened issue than a forgotten good idea.
2
 
 
1 hour later…
8:59 AM
> As the remaining problem is due to another already open issue, I close this issue.
 
 
4 hours later…
12:42 PM
0
Q: Is this function effective and secure to validate an IBAN?

Davide ToninI've found this explanation on Wiki on how to validate an IBAN.. Since the number generated from the transformation can cause overflow with all data type available in vba I've worked with string and I'd like to have someone else review.. Thanks in advance! From Wiki: Check that the total IBAN l...

 
1:25 PM
@theVBE-it'srightforme I bet that to do that, you need to make it a ref param object[].
 
2:11 PM
> I kind of like this idea very much, but the multiple-cells address string makes me wonder.. I think we'll need a regex that can find cell addresses in a string literal. How thorough do we want this to be? What if `D$27` is used as an argument to some worksheet function or UDF? Are we only looking at string literal arguments passed to `Worksheet.Range`, or anything that could possibly *contain* cell references? Should we also validate the value argument to a `Range.Formula` assignment?

Since
 
 
2 hours later…
4:08 PM
ok so i need a naming help.
 
Normally I would use vbNullString for ZLS. However I Have a lame API where I must pass in a ""
and I thought to make it a variable... I don't think I even can make it a constant since that might just end up being like vbNullString (e.g. a null pointer, which will _not_work. The lame API wants a initialized pointer to a zero-length string)
sooo... LameAPIWantsAZLSThatsIsInitialized ?
A mite too wordy.
 
hm, Public Const EmptyString = "" shouldn't be a null pointer
 
let me double verify that.
I think you're right. I have a non-zero StrPtr() for it.
so yeah I can make it a constant, even better. But EmptyString might make one wonder why am I not using vbNullString
 
only vbNullString would give you a zero StrPtr
Public Const EmptyString = "" ' note: not a NULL string. use vbNullString for a NULL string pointer
#CommentsFTW
 
4:12 PM
LOL. I'm now hoping that the future coder will actually think to look at the definition
as opposed to changing the call sites to vbNullString and thinking me a dunce for not knowing better.
 
hm, can we annotate public consts?
aw, @VariableDescription doesn't work on Const declarations :)
 
[removed]
 
I need to remind myself to fix my ducky
it's still broken. :(
also, did you try just @Description?
the Properties is grayed out for a const in OB, so most likely VBA doesn't allow annotations but then again, it doesn't allow few features so who knows....
 
makes sense if constants are just inlined into the p-code at compile time
wait no, doesn't make sense... consts exist in the typelib ...right?
 
^
 
4:26 PM
I'm not seeing any reason why they couldn't have a docstring then
well from a COM standpoint. VBA not allowing it is... unfortunate
 
Confirmed:
[uuid(26387857-0463-4F01-B852-8D34BBFA60B9)]
library zzTest
{
	[uuid(26387857-0464-4F01-B852-8D34BBFA60B9)]
	module constants
	{
		[helpstring("foo")]
		const long foo = 1;
	}
}
The constants must be in a module; otherwise, it won't be exposed.
Ok, yes, the Properties being disabled was a lie after all.
 
@Duga Should there be a to indicate host specificity?
 
4:42 PM
Public Const z As Long = 2
Attribute z.VB_VarDescription = "zzz"
@IvenBach pretty sure we have tags already. Go ahead and add it. :)
Don't be shy!
 
4:54 PM
@this interesting
 
VBIDE developers: don't mind the man behind the curtain
 
5:11 PM
pseudo-HN just saved my sanity lol...
set setupHourRange = .columns(3)
set sampleHourRange = .columns(4)
setupHours = .Index(setupHourRange,matchedRow)
sampleHours = .Index(setupHourRange,matchedRow)

hindsight, had i grouped those more appropriately for the range then the value, it would have been just as apparent
in the case of relative "types" or "usage" i believe that falls into the HN-realm
 
that's not pseudo-HN. That's systems app HN.
app HN is a good thing™ and was what the inventor of HN originally intended.
 
copy; was going with "pseudo" as i didn't know the "app" convention was the appropriate name... had only typically seen discussions on the Type, e.g., rA As Range, sA As String
and yay, i've read that article, so gg
 
yeah that'd be "system HN". Evil™
 
copy; will try to remember the nomenclature
 
5:29 PM
I try to properly qualify "Hungarian Notation" with "Apps" or "Systems" whenever I use it in my writing ...please don't hesitate to let me know if I leave "Hungarian Notation" unqualified anywhere.
mnemonics: "apps are useful, systems are stupid"
 
When I change the logic to get the document name by first looking at the file name and using the caption as a fallback, should I add a new property DocumentName or simply change the implementation of ProjectDisplayName?
 
@M.Doerner are you using the BuildFileName method on the VBProject?
Given the volatile nature of caption, I'm indicated to keep them separate so we have more control over whether we want to take the caption which may contain garbage or truncations.
 
5:52 PM
@MathieuGuindon apps are alright*; aa:ss lol
 
That's actually better since apps HN is technically a solution to a shortcoming of the compiler / IDE tools
e.g. there's less reasons to use Apps HN in C# since you can just rename and use big words™ and not type them all because of intellisense.
WidthFromScreeenToLayout would not be as convenient in a notepad.
 
@M.Doerner I think I'd go with changing the implementation of ProjectDisplayName
 
Currently, we always use the caption.
The name will be a lie afterwards, though.
 
ugh
huh wait how so?
regardless of where/how we get the name from, it's still a DisplayName
 
Ah, from our perspective, not the one of the VBE.
 
6:01 PM
@this NotNullEmptyString FTW?
 
@this ask for forgiveness instead of permission. Understood.
 
6:21 PM
@FreeMan I guess so? Feels like it would induce headaches.
NonNullString
Nah.
 
Maybe DumbString is a better name. If I can't be succinct, I can at least induce "what? Why" reaction from the future coders.
 
@Duga It is evil, but supported: double quotes in folder names.
 
I don't think we should support it.
that will muck up the import/export
 
6:25 PM
I think all we can do is make an inspection for it.
 
I suppose but that feels like we are misleading users into a cliff; they won't know that it's a bad path until they fall off.
 
Well, the MoveToFolderRefactotingAction supports it now. That does not mean that a full implementation of the refactoring will not reject it in the validation step.
 
@MathieuGuindon in regard to your blog/writing, have you ever given a thought about having guest writers and doing a layman, intermediate, and expert, format for a topic?
my wife has been really tuning into the "explain science" or something on youtube, which has been trending quite a bit. they have a low level explanation, an intermediate explanation, and an expert explanation, of the same topic.
 
I like that idea very much!
 
Does the FileName property on the VbProject return the full path?
 
6:34 PM
BuildFileName actually returns a full path of a hypothecial DLL file
which would have the same filename as the actual document but not the file extension
 
"Be our guest!"
 
@Cyril Layman's explanation for the win. Help build a bridge over the gap to knowledge island.
 
@Cyril I love that idea, too.
 
Hm, why do we have that property and do not wrap it in a try catch?
 
does it throw?
 
6:35 PM
I guess it will throw whenever FileName throws.
FileName throws for unsaved files.
 
our wrappers don't though
 
I know
We wrap it in a try catch.
 
I was wondering why we do not do the same for BuildFileName.
 
thinking it just returns an empty string and doesn't cause problems
or..
or it's just not used and we haven't bothered
 
6:37 PM
i'd think that just about any of us would be willing to help if you're looking to go that route, mat (given the near immediate feedback). just let us know topics and we could trial a shot
 
I think it is not used so far.
 
@MathieuGuindon for the record, I'd be happy to write a blogpost about regex in vba this summer (after handing in my bachelor's thesis)
 
So, what is our preferred display name, the FileName or the BuildFileName or should it depend on whether we look at VBA or VB6?
 
I would need to find a good explanatory usecase, though (and would need to brush up my skills)
 
@M.Doerner IIRC the idea was to get the project node in the Code Explorer to look exactly like the corresponding node in the Project Explorer does
> VBAProject (Book2.xlsm)
I don't remember if VB6 shows the build name in there... I'd think not
(poke @mansellan)
 
6:42 PM
[rubberduck-vba/Rubberduck] build for commit 12a06ee2 on unknown branch: AppVeyor build succeeded
 
Trying to add intellisense to a function... changing the member properties doesn't appear to save. any immediate thoughts?
process->find member, right click, select properties, type into the prompt, hit OK.
vbaproject is locked (i've currently got it unlocked)
 
> # [Codecov](https://codecov.io/gh/rubberduck-vba/Rubberduck/pull/5387?src=pr&el=h1) Report
> Merging [#5387](https://codecov.io/gh/rubberduck-vba/Rubberduck/pull/5387?src=pr&el=desc) into [next](https://codecov.io/gh/rubberduck-vba/Rubberduck/commit/dc732efef8fb3a7ced16e4af16e3257ed10fea11?src=pr&el=desc) will **increase** coverage by `0.17%`.
> The diff coverage is `86.6%`.


```diff
@@ Coverage Diff @@
## next #5387 +/- ##
==========================
[rubberduck-vba/Rubberduck] build for commit 12a06ee2 on unknown branch: 86.6% of diff hit (target 60%)
 
@Cyril hm, I've only succeeded in doing that using xlDNA in C#
 
copy
i think the only other way to do it is on workbook_open to call subroutines that register the descriptions for the specific macros?
beyond the property change (which is supposed to work)
 
6:58 PM
@M.Doerner speaking for VBA, I think FileName is fine since it has the file extension. BuildFileName wouldn't have it.
 
That was my thought as well.
However, I have no idea about VB6.
 
@this At least it's explicit that it shouldn't be NULL. Most people would think to ask why before changing it.
 
Let's see how I can underp the derivation of the display name from the caption, i.e. the fallback solution.
 
Interesting. BuildFileName works even on an unsaved project
So in theory, you could use BuildFileName as a fallback after FileName
but you'll have to strip the bogus .dll, of course.
Too bad it does not return the document name, though.
 
I guess, I can use that as a last resort.
I might still get the name including the file extension from the caption.
I seem to be able to get the document name from the caption as long as it is shorter than 58 characters.
 
00:00 - 20:0021:00 - 00:00

« first day (2083 days earlier)      last day (97 days later) »