« first day (1902 days earlier)      last day (1278 days later) » 

9:00 PM
a let assignment isn't really suspicious if RHS isn't an object, no?
 
There's two problems you'd have to consider here.
 
A separate inspection has the advantage that ObjectVariableRequiresSet can stay as Error serverity.
 
we definitely want that
 
#1 is that each call takes 2 arguments. You'd have to pull that into a single type instance or something, then append N values of that data set.
 
I'm thinking of using a value tuple but have to remember how to properly do that.
 
9:01 PM
I just recalled, the ImplicitDefaultMemberAssignment will not fire, if Let is used.
 
#2 is that they aren't necessarily the same call. AppendStream followed by AppendString repeatedly wouldn't necessarily be improved--although it would be possible.
@IvenBach I'd create a new struct.
Also, I'd put the type on it as well. Instead of AppendStream, just make it Append(new Foo { Format, Type, Value })
 
I don't quite follow you on that.
 
@M.Doerner wait so Range("A1") = 42 doesn't fire anything?
doesn't feel right
 
No, Let Range("A1") = 42 does not fire anything.
 
wut lol
 
9:04 PM
Range("A1") = 42 will
 
by design or by accident?
 
It has been implemented like that before and there are even tests for this behaviour.
 
I would assert that this is not what we want
 
and I bet I'm in the git blame for that... sigh
 
while the Let means that it can't be Set-coereced, we still have code that doesn't do what it say.
 
9:05 PM
^
 
The old implementation actually looked at the letContext to see whether a LET was present.
 
(or rather isn't very clear in saying what it does)
consider also the case where a strange object has default property that is not Value
 
I can change that, if you wnat.
 
yes please! :)
 
It will just recurse in the resolution.
 
9:06 PM
which makes me think-- do we want everyoen to start using Range("A1").[_Default] = 42?
 
@this no? We want them to use ws.Range("A1").Value = 42
 
I think everyone would recoil in horror to that.
 
A quickfix will noot really have any other chance then using that.
 
@this no - we'll make the inspection info mention that sometimes the default member may not be the member you want
 
^
@Vogel612 yes that's actually what we want (or maybe Value2). But neither are the default which quickfix can only do.
 
9:08 PM
the xml-doc can go in more details about it
 
An idea, though is that we can further check if a member is hidden & bracketed (or maybe just or'd) to add a TODO change the default member
 
to make users change it to Value or Value2 manually
 
if it's parameterized, they want Item
 
I think Excel is the only one to have this WTFworthy behavior of using a hidden & bracketed member as its default member.
 
9:10 PM
but Range isn't the only WTF in its type lib :)
that said if that's the case, and given Excel is probably our host ~90% of the time, it could be worth having some Excel-specific logic in there
hmm, could we have an Excel-specific quickfix?
like, if the host is Excel and we're looking at a Range, some MakeRangeImplicitDefaultMemberCallExplicitQuickFix could look at how the member call is parameterized, and yield a call to Value or Item accordingly?
wait no, not the host - the library
 
@Duga #ShouldIBlameCaching.com
 
@MathieuGuindon yea, that's the relevant part.
 
> Please note that according to the specification all three expressions in For i = <expr1> To <expr2> Step <expr3> are coerced to Double, not to Long.
 
@23fc9a62-56de-47fb-97b4-737890 Structs can't be null?
 
9:14 PM
@IvenBach Today you learn :)
That's right.
 
:derp: it's a value type so that's a nope.
What IF I don't provide that info?
 
and if Excel lib isn't referenced, then we don't list the Excel-specific quickfix
IOW the inspection doesn't have to care for Excel-specifics, just the quickfix
 
A struct is to C# as a UDT is to VBA.
 
@Duga nice catch!
@IvenBach exactly!
 
is it, though?
 
9:16 PM
Not 100% exactly.
 
I doubt that UDTs are allowed to be stored on the stack...
 
aye, you can't pass them around without cursing
 
But cough I'm using it loosey goosey hand-wavey right now.
 
@IvenBach exactly!
 
Mkay... I've created the struct now how do I instantiate one? Ignore my terribly incorrect terminology right now.
 
9:18 PM
@IvenBach new.
Just like a class.
 
> **What**
The inspection should find let assignments that require default member accesses on both sides of the assignment.

**Why**
It is not unlikely that such an assignment is an error and the actual intention was to use a Set assignment between the objects.

**Example**
This code should trigger the inspection:

```vb
Public Sub DoSomething()
Dim target As Excel.Range
Dim source As Excel.Range
target = source
End Sub
```

---

**QuickFixes**

1. **AddSetQuick
 
@23fc9a62-56de-47fb-97b4-737890 It's my questions like these that make me feel inadequate...
 
LOL.
I know the feeling.
 
@Duga question: should that inspection ignore LetStmtContext that have an actual explicit LET token?
 
9:20 PM
I mean, I learned what a REST API was just the other day.
It's an HTML POST/PUT/GET/DELETE call...
 
meh. let's not give our users a reason to use Let
 
@MathieuGuindon IMO, no because while it's not Set, it's still implicit.
Ducky should be saying "say nope to dope, ugh to drugs, and explicit No to implicit" to the users.
 
but if I explicitly write Let target = source, clearly my intent isn't to Set something
 
(Ok I dropped the ball there with the rhyming but you get the idea)
Obviously not but why be implicit about what member are you accessing?
Don't forget that it can be chained, too.
 
@this aye, and that's ImplicitDefaultMemberAssignment's job to flag it, no?
(and will still flag it regardless)
 
9:23 PM
Let dumb = dumber => Let dumb = dumber.Dumbest.DumbestOfThemAll
hmm. I guess you're right.
 
OK, I can see that we should exclude the ones with explicit Let.
 
for the proposed supsicious inspection, yes.
 
also, wouldn't making the LHS & RHS implicit calls explicit be a valid fix?
 
BTW, I found another situation where this is really hideous, when assigning function return values.
However, there it will most likely trigger the FunctionReturnValueNotSetInspection.
 
we're starting to have quite a lot of pretty nifty inspections :glee:
 
9:28 PM
@23fc9a62-56de-47fb-97b4-737890 Then I'm in good company. My WTF-is-this-face is thoroughly being used right now.
 
@23fc9a62-56de-47fb-97b4-737890 there's also HEAD and OPTIONS and the http 1.1 standard allows arbitrary verbs, though the server is not required to support them
 
@Vogel612 Yep.
That's the advanced stuff, though :)
 
for 99% of the cases you don't need HEAD or OPTIONS
 
And PUT and POST are fairly similar.
Just PUT is idempotent, IIRC, and POST is not.
 
some REST APIs make a distinction on HEAD and GET for async requests, though
 
9:31 PM
I thought that HEAD is required to be implemented for all GETs....
 
some REST APIs use PUT to GET stuff, and they need to burn.
 
GET and POST can handle everything else though.
 
@this most servers just forward it to GET
 
PUT to get stuff is strange.
 
9:31 PM
^
 
@MathieuGuindon ~grabs flamethrower
 
@Vogel612 I see. IINM, they do correctly return empty bodies, even though using GET would have had bodies.
 
Isn't is supposed to be GET -> get, POST -> create, PUT -> update, DELETE -> delete?
 
I can go back to Hosch250 on Saturday!
 
At least for storage.
 
9:33 PM
I'm getting a little tired of being 23f.
 
@M.Doerner in theory, yes.
 
TBH, REST never really felt much of a standard anyway. Everyone never actually do it consistently
 
And then people mess it up.
 
Although it's hilarious getting comments about it. One person even pinged me on LinkedIn about it :D
 
9:33 PM
damn
 
LOL
 
Anyway, TTQW. See you tomorrow!
 
yeehaw ttqw here to
(that started as a typo with "yeah" rendered as "yeha" and I just rolled with it)
 
for me the biggest annoyance is that you have to still do a lot of reading to use someone's API because one API might like to use query parameters while other API wants everything in the body, while yet another might use a mixture. That doesn't feel like an improvement but hey, it's popularâ„¢!
 
9:46 PM
@MathieuGuindon At least the following is not legal.
Private Sub TestSub()
    Dim target As Object
    target = New Excel.Application
End Sub
 
Makes sense, the New keyword basically prevents the let assignment.
 
No default member access on newStatemets.
 
we get no such thing with CreateObject/GetObject/equivalents, though.
 
That is because they are functions and not statements.
 
@M.Doerner phew!
now wrap RHS in parens, and I bet it befomes legit
 
9:48 PM
I will have to enhance the inspection a bit to recognize that, though.
No, it does not.
No default member coercion on newStatements.
 
Well, I will double check.
I might have conflated two things here.
I hope not.
Oh darn, it is legal.
I conflated Let coercion with procedure coercion.
You cannot access procedure default members in call statements from freshly newed up objects.
BTW, that is one of the most stupid ways to assign the string Microsoft Excel.
 
to be honest, the whole business with the parentheses annoys me the most about VBA.
I don't know what Joel was smoking but he had to be smoking some hard stuff at that time
 
The version without parentheses is also legal.
 
I'm confused. Are we talking about this? target = New Excel.Application
 
9:58 PM
So when you paste HTML info into excel it converts according to the <div> and other tags to be in the correct cells?
 
Yes, that is legal. I just confused it with the procedure coercion.
 
yuck
Yes, @IvenBach probably a relic from the era when Microsoft was "you can HTML anything in Office!"
 
Hrm... And that builds on top of the UTF8 encoding or whichever it's encoded in, leading back to Joel's article.
 
-_- no ones touched my question
looks like im screwed
that or im going to have to wait a couple months
 
that three hours old one on SO?
 
10:11 PM
its already a couple pages in
but i also posted it on reddit and spice works
oh... it moves
cuz its on the first page now
 
10:24 PM
why are you doing it from powershell?
I'd consider just doing the actual work in SSIS or Access, and just use PowerShell to start either as opposed to doing the work in powershell.
 
@23fc9a62-56de-47fb-97b4-737890 Nearly - it's an HTTP POST/PUT/GET/DELETE, and stateless. Using HTTP semantics as they were designed, rather than jamming huge globs of state data in a POST.
@this TBF, I don't think I've seen it claimed as a standard anywhere. Its more of an ethos iiuc.
related: I highly reccomend RestEase if you need to connect to REST endpoints from c#. Very elegant API.
 
I do recall some ppl waving their hand that it's not a standard or spec, whatever. But frankly it's not much if everyone and their dog can do anything they want
 
(ymmv :-) )
 
10:39 PM
it's kind like "Ok, we'll just agree to use verbs and use it as what it say but how you want to do it, well, do whatever"
 
@this Swagger. Just saying :-)
 
Yeah I know about them. It does help but still.
You can't implement someone's REST "API" without reading it through.
Contrast this to a nuget package or even a dumb ol' DLL.
yo, there be function here, you call it with so and so and it gives you this fo shizzle.
 
Sure.... but given the choice between downloading some WSDL and (auto?)genning a proxy, versus loading a swagger page and hitting Execute, I know which I prefer :-)
 
with REST, it's all way back to C where we have to wrangle the calling convention, the stack location, and all mindless plumbing details BEFORE we get to actually using it.
 
You still have the option of putting proxies in a NuGet, but nobody feels the need...
 
10:43 PM
Autogen might be nice thing to do but if something goes wrong, you better know what the hell is going underneath the stack. That is a main reason IMNSHO why WCF or SOAP failed
 
well that, plus it's sooooo blooooated.
 
and I'm not talking about proxies to be clear. I get the desire to not have to deal with proxies at all. I'm totally down with that.
but do we really have to wrangle the calling convention?
 
pretty happy with RestEase tbh
 
@this tbh, not really following... calling convention?
 
Ok let's start over.
In C you had to agree on a calling convention.
 
10:45 PM
sorry! I'm probably being slow. Been a long day :-)
 
e.g. do you push the parameters on the stack? On the heap? in what order?
BBOOOOOOORRRRRRRIIIIIINNNNNNGGGGGGG
I just want to call the function!
 
yep, vaguely aware that C had such issues
(Not knowing anything much about C)
 
and that is why people quickly decided that in higher level language to not bother with that plumbing details.
but now with REST API, we are back to wrangling the calling convention.
Why? Because we can choose between query string parameters, body
we also have to negotiate the content. JSON? XML? Form encoded? Some weird media type?
BBOOOOOOORRRRRRRIIIIIINNNNNNGGGGGGG
 
Oh yes, I see...
mulls
 
That's why I think REST is a step back in that respect.
Do not get me wrong. I'd much rather use REST over WCF, SOAP, whatever
 
10:47 PM
still mulling
 
and we have nuget packages that makes REST stuff easy, but there's no escaping the fact that I must read and understand how to call someone's API before I can actually use it.
and then you have those clowns who do a half-assed job of implementing their REST API like using POST for everything, or using GET to update something or what have you.
So in that respect, it's worse than C's calling convention situation because you can only have so many calling conventions, but with REST, the variations are limitless
 
I guess I don't see it much, because with RestEase all that is abstracted into the client interface.... It's the API designer's job to define which params are query, body, form, the caller just hits a C# interface. Media types, not so much, you still need to know if you're getting XML or JSON for example - but you don't have to set headers explicitly.
Only really works in a work setting, where you know your callers are modern .net. On the open web, it wouldn't really work.
 
wait a minute. Keep in mind i haven't used RestEase, only RestSharp (been meaning to look into RestEase but hadn't need yet)
are you telling me that REstEase generates proxy?
 
yes, dynamically with Reflection.Emit, from an attributed spec interface.
it's really quite nice.
 
oh ok that is nice
 
10:53 PM
^ will generate a proxy at runtime
 
does it depend on having swagger?
 
no, it knows nothing about the server at all, let alone swagger.
its a dynamic client proxy generator
it only knows what it's told in the client interface
 
sorry I'm confused.
so I still have to read some clown's API specs and write my proxy?
 
think WCF proxies, but emitted at runtime, and using an attributed interface as its input rather than server-provided WSDL
 
Ok, so I still have to read the clown's API specs to write that interface
BBOOOOOOORRRRRRRIIIIIINNNNNNGGGGGGG
:D
 
10:57 PM
@this Hopefully the clown wrote it for you and put it in a NuGet. That's what we do at work. Boring for the API clown, easy-street for the caller.
Like I say, not really an option on the open web.
(Unless you wanna write an interface for random-clown's API)
:-)
 
yeah - and that's my biggest beef with the REST. I love what they have done w/ Swagger, esp the standardization of docs page
but it still doesn't get away from the fact that I must negotiate the parameter placement, the content / media type and all that kind of crap
 
TBF, I'm surprised nobody's come up with a way to use Swagger's json spec to do something like WSDL used to do...
 
in end all I want is function name, a bucket for my parameters, and a return value.
don't bother me with silly nitpicks about query string parameters, headers, body, and a bajillion other hiding places HTTP offers.
I think you can see that I'm quite lazy. :D
 
In a closed environment, REST can be really very nice. Inject an interface, call as if local.
I take your point that on the web it might suck.
@this Don't knock laziness. Often it takes hard work to enable laziness.
3
 
^
 
11:03 PM
I would say though that RestSharp is pretty low-level. You'd relieve at least some of the boredom using RestEase.
(or at least reduce your SLoC)
 
I think I need a breadcrumb with this refactoring.
Anyone available?
 
@IvenBach uhm, I can try?
 
I'm working on refactoring the copy to clipboard command.
One sec I'm trying to clean it up a bit so I can push to a repo and link to it for a better example.
 
@mansellan ~sigh
"used to"?
also... you sure that's not the case?
After all in Java enterprise land, Swagger JSONs are generated from JAX-RS annotations
that's basically ready for WSDL Schema generation or any kind of dynamic type declaration shenanigans you can think of..
 
11:19 PM
googles JAX-RS
hmm, with Swashbuckle it uses refection and XML docs to generate the spec JSON
not seen anything that can consume that to generate a .net client proxy though. perhaps there's something out there, but not found it.
@Vogel612 Yes, used to. Friends don't let friends SOAP :-)
 
yea, about that...
 
for work, I've needed to deal with manually crafted SOAP bodies
 
Sorry, s/b "S"OAP :-)
 
passed through a stringly typed in memory message queueing system
 
11:23 PM
ewww
 
yea it stopped working when I upgraded the MMQS dependency version
 
You had my sympathy at "Java"...
 
@Vogel612 heads up, I just replied to a comment on WP linking here; guy has a question about VBA SDK and doesn't know where to ask, so he might pop in and require write access
 
I'll be around for around half an hour at least now
 
11:27 PM
@MathieuGuindon WP?
 
wordpress
 
ah ok
the blog
 
@mansellan github.com/rubberduck-vba/Rubberduck/pull/5095 has my changes. The last commit was consolidating the logic. I'm running into the problem of using IEnumerable<object> results which is coerced later into a 2D array that's then later use by ExportFormatter.
 
[rubberduck-vba/Rubberduck] build for commit f815e05c on unknown branch: AppVeyor build failed
BUILD FAILURE!
 
@IvenBach uhm, are you sure that's a 2D array? You have an IEnumerable<Object>, which you're calling Select(result => result.ToArray()) on.... Air coding here, but that means "take each object in the set, and turn it into an array"
If you set a breakpoint right after that line, does resultsAsArray look like you hope it would?
 
11:34 PM
[rubberduck-vba/Rubberduck] build for commit ab4ad177 on unknown branch: AppVeyor build failed
BUILD FAILURE!
 
About 75% of the time I can work with things without fully understanding whats going on with them. "'object' does not contain a definition for 'ToArray' and no accessible extension method 'ToArray' accepting a first argument of
type 'object' could be found" which makes sense.
 
Yeah that's what I'd expect
 
I don't really want to use object but that's the least common denominator between them.
 
each element of your IEnumerable<object> is an object. So your Select works on individual objects in the the set.
and object doesn't have a ToArray() method.
 
That much I can follow.
 
11:37 PM
So, you're passing in an IEnumerable<object> ("some sequence of things"), and hoping to make it 2D. You don't have enough information at that point to do that.
Where are the boundaries between rows? How would it know?
 
For writing out the information? I don't quite follow.
 
Sorry I'm probably not explaining very well...
IEnumerable is just something you can progress through, from start to finish, in sequence.
and object is basically "something"
so, if you have "something1", "something2", "something3" - how do you know that the first 2 are on the first row, and the thied is on the next row?
 
You don't and can't know. You need some inkling of a structure. How it's formatted to know that. Similar to encoding.
 
I think you need to pass something other than IEnumerable<object>to your function, because by that point you've lost the information you need to make a 2d array.
 
11:44 PM
You are right.
I think I'm too close to the code right now and need to step away to think about it for a while.
 
If you had IEnumerable<IEnumerable<object>>, a list of rows, each of which was a list of cells in the row, you'd be in a better place. But I suspect there may be a more specific structure possible
(Just from looking at that 1 line, haven't looked at the PR in the round)
 
rule of thumb, using object in .net code is a smell
 
^
IEnumerable<T> on the other hand, is often correct, per Liskov.
 
I tried T but I don't know how to indicate what it is. I don't use generics often enough.
5 mins ago, by IvenBach
I think I'm too close to the code right now and need to step away to think about it for a while.
 
[rubberduck-vba/Rubberduck] build for commit 46271afa on unknown branch: AppVeyor build succeeded
 
11:51 PM
I need to mull it over in my brain and come back to it with fresh eyes. Reviewing each result that's being supplied to refactor it to a more appropriate type.
 
@IvenBach So in IEnumerable<object>, T is object. In IEnumerable<string>, T is string.
IEnumerable<T> just means "An IEnumerable of something, which will be decided when I declare it. T could be string, object, Foo...
 
@IvenBach have you inspected the contents using debugger?
it'll tell you and you can then be more specific
 
Put another way, before generics, we just had IEnumerable. Each element was an object, so each element could be anything. A string, and integer, a Foo... there was no guarantee that any element would be anything like the one before.
Now that we have generics, we can say IEnumerable<string>, and the compiler will guarantee that every element has to be a string.
So, IEnumerable<T> just means "An IEnumerable where you can decide what type the elements will be"
 
...without incurring boxing when T is a value type
hence ArrayList being deprecated ever since
 
Also, see Java generics, where it can't make such guarantees, so....
;-)
 
11:59 PM
@MathieuGuindon I wonder if deep underneath, ArrayList is the root of it all.
 

« first day (1902 days earlier)      last day (1278 days later) »