« first day (1405 days earlier)      last day (3545 days later) » 

11:00 PM
The ?. will be thread safe right?
 
@drch str + img
 
then where do you get image length from?
 
i think from nowhere..
 
so you have to send that too
right?
 
right
 
11:02 PM
your server code is expecting: str + imageLength + image
your client code is sending str + image
@JohanLarsson i actually assume not, because of this: stackoverflow.com/questions/4619593/…
 
so the client should send in the middle the image length
byte[] toSend = BitConverter.GetBytes(str.Length).Concat(str).Concat(ms.ToArray()).ToArray();
this here only concates
str + image
 
right
 
wrong
 
so the ms.Length would be the image's length?
 
well, "right" if we're saying str is 8Command|
 
11:05 PM
@drch puke
 
but str is only byte[] str = Encoding.ASCII.GetBytes("Command|");
 
yes ms.Length is the size of the stream
@JohanLarsson its equally thread safe as the existing verbose way though
 
I ususlly copy to a local before checking each level
 
if (person != null && person.House != null && person.House.Address != null) {
   return person.House.Address.City;
}
 
@drch not at all threadsafe
 
11:06 PM
i know
 
what he said
 
its equally thread safe as person?.House?.Address?.City
or unsafe as it were
 
sad news imo
 
@drch then how would i send the length with them too?..
 
well..
you would, you know, send the length
 
11:08 PM
@drch really? That's dum. Are you sure it's like that? link?
 
what do you mean? link to what?
 
@drch but client sends str + image, so the length wouldnt be all from whats after the str ?
 
@drch a source that says they implemented it that way
 
@drch Well, it's potentially more thread safe, as each step is stored in a local
still not perfect, though, as it's not really thread safe
in that something else could set a value and you could still return null
but a separate thread setting to null won't cause a NRE using ?. like it would with your checks above
 
if (person == null)
{
    return null;
}
var house = person.House;
if (house == null)
{
    return null;
}
...
Stored in a local equivalent to^?
 
11:11 PM
@JohanLarsson the feature works a bit more like that - more in a local in IL terms, though
 
ok good news
 
but that way, each stage is only evaluated once, and short circuiting works
 
avoiding NRE goes a long way
 
@KendallFrey BTW - for the source on the info related to that: codeplex.com/Download?ProjectName=roslyn&DownloadId=894944
the behavior is called out specifically:
 
yeah. chrome wont lemme copy paste from that pdf tho for some reason :P
 
11:14 PM
We expect that a very common use of this pattern will be for triggering of events: PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(X)));
This is an easy and thread-safe way to check for null before you trigger an event. The reason it’s thread-safe is that the feature evaluates the left-hand side only once, and keeps it in a temporary variable.
last two statements being the key ;)
 
i hope we get to call it the conan operator and not elvis
int? first = customers?[0].Orders?.Count();
looks funky
 
that will be so nice
Are you using VS2014?
 
not yet
but want to check out vnext a bit more so, soon
 
11:38 PM
@ReedCopsey Is . more threadsafe than .? ?
 
@KendallFrey Not really - only less likely to cause problems since there are fewer operations
 
@ReedCopsey figured as much
Hmm, I wonder what kind of problems this could really cause
Maybe if someone does fuh = null; fuh = thing;
 
well, with ?., it'd just give you "old" data or null when it shouldn't, potentially
but not too likely to be a problem in practice
because, in reality, if it's a problem, you'd have a problem no matter what you do, and you'd have to synchronize some other way already
 
precisely
man, it feels great to have a conversation with someone who actually knows something
2
 
@KendallFrey unfortunately for you, I'm here now
<3
 
11:52 PM
( ͡° ͜ʖ ͡°)‎
 
work is making me feel so damn stupid lately. So much proprietary half ass code with no transferable learnable skills. Blah.
I'm going home now
 

« first day (1405 days earlier)      last day (3545 days later) »