« first day (1403 days earlier)      last day (3536 days later) » 

4:00 PM
Also why is this book layouted so weird
 
> layouted
lol
 
@CatPlusPlus It's customizable.
I can choose number of columns and width of lines etc.
 
And you chose to display the same thing twice?
 
@CatPlusPlus you mean the title "Solutions in C++"?
 
No, the entire block
 
4:01 PM
@CatPlusPlus Between "Kindle" and "Mac", the possible answers are endless.
 
The right side is left side scrolled further down
 
@CatPlusPlus I would not have noticed, but the labels of the examples give it away
 
I'm bad at directions
 
The software is kinda wonky.
 
A terrible book about terrible software with terrible layout and terrible advice
Could only be autotools
 
4:03 PM
Ugh auto main() -> int just stop it — Lightness Races in Orbit 5 secs ago
 
int main(){} is the briefest syntax
 
@StackedCrooked Makes sense, except the few examples I can think of that match in my main library have at least one member function template which uses variadics to essentially do an "emplace" operation
 
@LightnessRacesinOrbit I have used method templates in the header + explicit instantiations in the cpp file. But that only works if there's a fixed set of types.
 
@LightnessRacesinOrbit It's funny how he uses trailing return type for main, but not for foo::fun member function.
 
F&& f can't enter the cpp file and it's the bane of the task-based programmer's existence.
 
4:06 PM
hilarious
@StackedCrooked indeed. kinda defeats the object of having my variadic template in the first place.
 
@milleniumbug Well, auto return type IS the new coolness. :-D
 
Such hypocrisy.
 
centre&& cannot hold
 
pointer_to_a_message_distributor_instance->sendMessage<message_type>(args...)
 
message manager
 
@LightnessRacesinOrbit I have some very similar code.
 
@StackedCrooked No, struct abc is the implementation.
 
@Lightness, oh yeah, I forgot they speak Portuguese in Britain. — George Pompidou 1 hour ago
wtf
 
You just don't make it complete in the interface ever.
 
also
"Photons clearly have mass per solar radiation pressure" - wrong, this shows that they clearly have momentum, which for a massless particle like the photon is $p=\frac{h\nu}{c}$ (rather than $p=mv$ for a massive particle). — Kyle 12 mins ago
^ /cc @Puppy @R.MartinhoFernandes @Xeo @Rapptz @I forget who was talking about it
I like how the phys.se favicon looks like a combadge
 
user3010322
4:22 PM
Psst, guize.
 
user3010322
I have a question.
 
@LightnessRacesinOrbit I always thought it looks like a sombrero, unlike the Sombrero Galaxy.
 
user3010322
In, like. C#. With the Object Initializer Syntax...
 
user3010322
If you have a base class that's a collection, like Zoo : List<Animal> and then a bunch of public properties...
 
user3010322
4:23 PM
How do you set the base classes' stuff with the initializer syntax?
 
Why are you subclassing collections
 
Why are you writing C#
 
Why don't you ask in the C# room where way more people know C#?
 
user3010322
Oh, yeah. I forgot they had a C# room.
 
user3010322
Off I go then.~
 
4:24 PM
noob
 
@LightnessRacesinOrbit if you enjoy looking at code blobs (Actually a rare combo of templates and pimpl.)
 
user3010322
@CatPlusPlus I was subclassing them because I didn't want to rewrite the entire interface all over again.
 
What are you doing that needs that
You probably want extension methods
 
Why is subclassing a collection wrong?
 
@LightnessRacesinOrbit Can't find that comment.
 
user3010322
4:26 PM
Well, one of the devs on my team in a codereview complained that I had a public property that allowed you to set/get the whole list.
 
user3010322
They said that someone could set the collection to null.
 
@R.MartinhoFernandes Wellll it's there
 
Setters imply mutability! Bad bad bad!
 
user3010322
My initial response that if the user set the collection to null, that's what they wanted (And they deserve a null reference exception).
 
4:27 PM
@ThePhD oh noes
 
Then check for null? Or better yet, don't provide a set because it's dumb?
What does subclassing achieve
 
@ThePhD it's kind of a weak class invariant though, if you don't know whether it contains a list
 
@ThePhD I see where your coworker is coming from. I would tend to agree. However, I'd attempt to stifle this instinct and just stick with what you have, if it's by far the simplest option.
 
This question appears to be off-topic because it can be answered using commonly-available references. — Peter Mortensen 24 mins ago
 
I have the list as a field and expose readonly IEnumebarble a large % of the time.
 
4:28 PM
If you want to go by "if the user does this, then that's obviously what they want", then you might as well just let the user write freely to memory
the important question is, "if I'm given an instance of this class, what can I rely on?"
 
user3010322
@CatPlusPlus Subclassing achieves that if the object is not null, then the list is not null.
 
Uh no
You just move the null-check one level up
 
user3010322
Uh... yes?
 
If you have MyListSubclass Whatever { get; set; } the problem is still there and you get nothing
 
You don't do null checks.
 
user3010322
4:29 PM
Well, yes. That's the point. You check if the object itself is not null. THen it's subclass is also not null by default.
 
And you don't do null.
 
@StackedCrooked that looks very familiar
 
The real solution is to not make the property writeable, because the collection is mutable and there's literally no reason to do that
 
@LightnessRacesinOrbit great minds think alike
 
@ThePhD And if you check if List<T> is not null then it's also not null!
 
4:30 PM
@ThePhD not if your users can access the underlying list and set it to null, no
 
Subclassing doesn't guarantee you anything
 
@BoltClock Oh gawd that question still going.
 
@CatPlusPlus It guarantees inheritance.
 
Composition might, because you can enforce not-null in the ctor
But
It's overkill
 
Unless you are talking about WinAPI subclassing.
 
4:31 PM
Just do List<T> Property { get; private set; }, create it in the ctor and done
It will never be null
Unless you're dumb and write a class that breaks its own invariant
 
user3010322
The property was settable because in some places the list was set by TheList = new List<T> (){ new T(){}, ... }
 
But nothing can protect you from that
 
I never understood the advantages of public T x { get; private set; } vs public readonly T x; when x is only set in the ctor.
 
@ThePhD From outside? What for
 
Future compatibility?
 
4:32 PM
@PolymorphicPotato Changing field to property is a breaking API change
Also they behave differently
 
Ah. Yay.
 
If you're sure that you'll never change that, then sure, make it a field
 
user3010322
Properties also feed into the bullshit argument that people can "add function calls into theproperty and it still syntactically looks the same"
 
I prefer to have only properties as public API
 
user3010322
Which I hate, because if I have something that's supposed to be a dumb data struct it should just be a dumb data struct and I shouldn't have a web call going out when I access the property for the first time.
 
4:34 PM
Impure getters are fun when debugging.
 
@LightnessRacesinOrbit Nope, still can't find it :S. Link doesn't help.
-1
A: How can a photon have no mass and still travel at the speed of light?

ArgusAs I am a layperson, this is how I justify it to myself, as this is an opinionated Beowulf, please regard it as my "opinion" and not fact. In my view any two objects with mass that are directed toward each other will create an explosion. Taking this into account, I take two flashlights and point ...

Best answer.
 
@ThePhD Prime example is making the object reactive
And yeah debugging and other fun things
It also affects reflection
Anyway if you reaaaaaaaaaally want a writeable property, then just make it field-backed and check for null in the set
 
user3010322
If it's null, maybe I'll just .Clear() :v
 
Subclassing is still wholly unnecessary
(And again, doesn't solve your problem)
Because then you'll have TheList = new MyTheList() { ... } but it still can be assigned null
 
Ell
My heat shrink is too big.
 
4:37 PM
@R.MartinhoFernandes Ron Maimon's year-long suspension ends in 5 days. Looking forward to the inevitable shitstorm
 
And also your reviewer will laugh at you
 
user3010322
The problem is that someome, with a basic getter/setter, can set the list to null. If I subclass the list type, then as long as the object is non-null then the list is non-null (that's what I'm going for).
 
@ThePhD Inheritance does NOT give you that guarantee
 
user3010322
You can't have MyDerived d and then set the Base of derived to null.
 
With composition you can enforce that the inner object is not null but
The outer object STILL CAN BE
Because the problem is at assignment site, and that doesn't change
You still need to null-check in the property
Because this is the only place where the check matters
 
4:39 PM
@BoltClock lol, keep us updated plox
 
@ThePhD But you can have null MyDerived, and then you just substituted one class for another in the original problem
"As long as the object is non-null" is the problem
Because that's the assumption you cannot do
 
user3010322
You're already checking whether MyDerived is not null. My problem is when MyDerived is not null but the list is null.
 
user3010322
That's the condition I'm trying to prevent. if (myDerived != null) { /* myDerived's list, subclass or property, cannot be null */ }
 
@BoltClock I thought he quit regardless.
 
The problem is in the brain of the person who decides to use null.
 
4:41 PM
If you're checking whether class derived from list is not null, then you might as well eliminate the derived class and check if the list is not null directly
 
user3010322
u.u;
 
And all of this still happens in that property of yours, not in the list
 
user3010322
All I want is the invariant that if myDerived not null then myDerivedList is not null
 
user3010322
I'll just use a property and hijack set.
 
That is meaningless invariant in this case jesus christ
 
Xeo
4:43 PM
Welp, guess I'm out cold until Friday
 
You're inheriting from List<T> because you want what used to be a property to be guaranteed non-null?
 
@Xeo sick leave?
 
Xeo
ye
 
Be glad you didn't have two of those properties!
 
Xeo
stupid cold
 
4:44 PM
I wonder what you would do then.
 
posted on August 19, 2014 by Kangyuan Niu

In Visual Studio 2013 we shipped an implementation of non-static data member initialization (hereby referred to as “NSDMI”), which is a feature that allows code such as the following: class C { int n = 42; }; Here, n is a non-static...(read more)

 
I've only had three or four sick leaves ever. This includes school years.
 
Xeo
hahahaha
I've been on sick leave so increadibly often during school
 
Did you like that? (Not having to go to school?)
 
Ell
I've never been on sick leave in school
 
4:45 PM
or was it terrible?
 
Xeo
@StackedCrooked I hated school, rather.
 
> Unfortunately, the code in our compiler (some of it written 30 years ago) for handling initialization suffers from many longstanding architectural limitations. This code was sufficient for C++03-style initialization, but NSDMI, a C++11 feature, caused it to exhibit these limitations as severe bugs.
 
Ell
actually. I've been out afternoons for the dentist :P
but I go back after
 
Xeo
There've been a bunch of times were I just plain skipped school
with no excuse
 
4:46 PM
I disliked school also. But I always went to school if I had a cold because I didn't want to catch-up with notes afterwards.
@Xeo saboru!
 
MSVC: so broken it leaks into the past
 
@StackedCrooked I never took notes. :D
 
@CatPlusPlus You should probably ping him. This will be lost in the flow otherwise.
 
Robert Harvey vtc C++14 keywords questions as "too broad"? Is he drunk?
btw that post is now on the Hot Network sidebar list
 
@PolymorphicPotato The teaching material was usually paper sheets with text and gaps to fill in during classes. So without notes I wouldn't have the class material.
 
4:47 PM
@LightnessRacesinOrbit Oh my. Rep incoming.
 
@LightnessRacesinOrbit I often find nonsensical comments left by Robert Harvey.
@StackedCrooked I wasn't motivated so I didn't care.
 
@LightnessRacesinOrbit "Too broad" seems stupid, but I do not like the question to be honest.
 
user3010322
@R.MartinhoFernandes Someone internally actually had that same problem too and lodged a massive complaint on the VC++ Special Interest Group thread.
 
user3010322
I ran into it too several times. ._.
 
"Please diff the drafts for me"?
 
Xeo
4:48 PM
@R.MartinhoFernandes It's not really on-topic, is it
 
user3010322
Also jesus christ, 30 years old
 
Actually these days you can ask that to GitHub.
Maybe...
 
user3010322
This makes me not want to join the Compiler team.
 
Xeo
@StackedCrooked Yeah, the prologue is increadibly long
 
4:49 PM
@R.MartinhoFernandes Are you of the opinion that every C++ programmer should have the drafts on hand?
 
Xeo
but good nonetheless
 
@ThePhD And then they discovered entire WG died of old age 15 years ago?
 
user3010322
WG?
 
Xeo
Working Group
 
SIG whatever
 
4:50 PM
@Xeo I've reduce the volume for Makina and Michiru though :)
 
Xeo
@StackedCrooked Whaaaat
 
user3010322
Ooh. No, it's actually a very active thread.
 
Xeo
Too crazy for you? :P
 
user3010322
But there's an old one that actually died, cppdisc
 
Xeo
Michiru has one of the most fun routes.
 
4:50 PM
@Xeo A notch or two.
 
@CatPlusPlus If they were still working (and didn't stink too much), who cares whether they were alive or dead? Maybe if somebody had administered a few more fatal beatings when they were younger...
 
Michiru is kinda fun. Makina is a little annoying.
 
Xeo
Btw, I do recommend to check the bad ends first, to get a little uplift on the good ends.
The bad ends are pretty heavy
 
I assume the story will also take a more serious turn after a while..?
 
Xeo
oh hell yes
 
4:52 PM
I'm planning on doing Makina route first.
 
MSVC is literally IE
 
Sasaki last.
 
And IE is literally Hitler?
 
Xeo
@StackedCrooked Heh. My play order: Makina -> Sachi -> Michiru -> Amane -> Sasaki
or maybe it was Michiru second and Sachi third
 
4:53 PM
@Xeo I plan a similar set of routes.
The stupidity of the humor is incredible though.
But funny at times.
 
@Xeo It's fine
 
@Xeo dammit you are scaring me. I did not plan to become an emo wreck in the coming weeks.
 
@PolymorphicPotato Hitler is literally IE.
 
@R.MartinhoFernandes :(
 
Xeo
4:59 PM
@StackedCrooked Hehehe. It's mostly the bad ends that hit hard.
But especially Amane's route does get damn dark, without the bad end.
 
Fantastic responsive UI design, this. — Lightness Races in Orbit just now
 
@Xeo I usually avoid those.
I don't like feeling bad.
 
Xeo
I'm a completionist, so I tend to play every ending
usually the bad ones before the good ones, though
 
@LucDanton They're on GitHub, so they are on hand for everyone to be honest.
 
@PolymorphicPotato Often?
 
5:05 PM
Added GitHub-powered answer: stackoverflow.com/questions/25380599/…
 
Language lawyering though :s
 
@LucDanton It was at least sort of a language-lawyering kind of question to start with though.
 
Passing signatures as macro parameter is messy.
 
Damn, I should have waited until tomorrow to post the GitHub answer.
I'm terrible at repwhoring.
 
#define COMMANDS(X) \
    X(Sum,   int(int, int)) \
    X(Unsum, tuple<int, int>(int)) \
    X(Foo,   tuple<string, string>(tuple<string, string>)) \
This will surely have lexer errors.
 
5:09 PM
@R.MartinhoFernandes why, what's tomorrow?
 
@melak47 No repcap.
 
@R.MartinhoFernandes Because global variables are zero-initialized. So they're initialized. So.... yeah.
 
Should I wrap it all in extra ()
 
@LucDanton Ain't it amazing that to show that the future that was described is actually happening now you gave as evidence a technology that is 18 years old?
 
That’s not the adjective I would use.
 
5:13 PM
Too many "that" in that sentence.
Dunno what to think of this last one, though.
 
@R.MartinhoFernandes I'm sure you meant: "Dunno what to think of that last that though." :-)
 
Wordplay is awesome.
Cue Jerry saying foreplay is better.
 
not as awesome as my new profile pic
 
user3010322
Huh.
 
user3010322
This is kind of bizarre.
 
5:21 PM
@R.MartinhoFernandes ...most of which wasn't particularly new then. ActiveX added some asynchronous proxy stuff, but the rest is considerably older still.
 
user3010322
The ObservableCollection, ObservableMap, etc. classes in .NET don't take an ICollection or an IDictionary type.
 
user3010322
In its constructor, that is.
 
user3010322
So it has a fixed type of storage, rather than an interface-based backing storage you provide.
 
user3010322
That's... silly, and not very composable.
 
user3010322
I should rewrite it to be better.
 
5:22 PM
Damn you Jerry.
1 message moved from bin
I had this planned and you let me down.
Boy, I'm bored.
 
Ell
Help me write my cv.
 
@ThePhD You mean, not?
 
Ell
My cv is mostly blank, I don't know what to do :L
I don't have any experience yet
 
user3010322
@R.MartinhoFernandes That's... bizarre. I can't find that.
 
user3010322
5:25 PM
Wait.
 
Platforms: Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
 
user3010322
..... Windows UNiversal 8.1
 
user3010322
But it should be here!
 
user3010322
Maybe it has a default constructor?
 
user3010322
5:26 PM
Oh, there it is.
 
user3010322
Awesome.
 
user3010322
I wonder if IEnumerable will take advantage of something like key searching for a dictionary...
 
There's no ObservableMap, though.
 
user3010322
@R.MartinhoFernandes Rather than put that in the framework, Windows 8.1 apps generate an ObservableMap class and back it with a Dictionary<string, object>
 
user3010322
5:28 PM
Yeah
 
user3010322
When you make a new WIndows 8.1 Store/Phone app, it creates that class for youi
 
user3010322
and dumps it into your project in the Shared project.
 
user3010322
(In the Common Folder).
 
user3010322
I guess ObservableList for IList really isn't necessary, then?
 
user3010322
5:29 PM
Because something like IEnumerable would have add on it?
 
user3010322
No it doesn't... how does ObservableCollection implement Add and friends then...?
 
user3010322
Does it cast the IEnumerable to an IList?
 
user3010322
That's actually pretty smart.
 
oh my god
 
user3010322
Your pizzza is more delicious that usual?
 
5:31 PM
my hosting provider keeps on trying to bill me every day
and I get an email each time
that means I'll get 7 more emails
when I told them I'm going to pay on the 29th I kinda expected them not to spam me anymore
fucking hell
 
@AlexM. That's why email programs have spam filters, and (especially) message coalescing.
 
@ThePhD No, it copies it.
 
doesn't a spam filter apply to the sender's address?
I wouldn't want to block all of my provider's emails
 
There's no other way to guarantee the invariants.
 
user3010322
@R.MartinhoFernandes ... Wat.
 
user3010322
5:33 PM
It Copies it?
 
It's the only option that works.
 
user3010322
I mean, if the T is a reference that's not expensive but what the fffffffff.
 
user3010322
@R.MartinhoFernandes Couldn't it at least include the IList cast as an optimization? DDDD:
 
@ThePhD lol
no pizza today
 
No, because if it was a IList copying would still be the only option that works.
 
5:33 PM
I'll have some fries and chicken nuggets
 
user3010322
@R.MartinhoFernandes For Add ?
 
with garlic sauce, I think I still have some left
 
user3010322
But IList has an ad- WAIT ARRAYS IMPLEMENT ILIST ololololololol.
 
@ThePhD For ObservableCollection.
 
Hey @ all
 
5:34 PM
@ThePhD Arrays are still copied.
 
user3010322
You're losing me a bit.
 
What comes first? header guards or #includes? Does it matter?
 
Any collection you use to initialise it will be copied.
You can't guarantee ObservableCollection's functionality without the ObservableCollection being the only object that has access to the underlying collection.
It can't share it.
If you share it, you can easily have changes that won't be observed.
 
@Serthy Header guards, but it doesn't matter for correctness.
 
Thank you
 
5:38 PM
#pragma once comes first, then no header guards.
 
user3010322
@R.MartinhoFernandes Ah... that makes sense.
 
At least I cannot think of scenario when it would matter, YMMV.
 
user3010322
So I guess my implementation si bad then.
 
user3010322
I mean, right now all I do is ObservableDictionary( new Dictionary<T, K>() )
 
user3010322
5:39 PM
But you can pass it an existing reference
 
user3010322
ANd it won't copy.
 
user3010322
Because I actually wanted the feature of sharing the data.
 
If you share it with something that won't change it, it's ok.
And for that you can use IEnumerable.
Pretty sure ObservableCollection implements that.
 
user3010322
Yooou've lost me again. :D
 
ICollection<T>, IList, ICollection, IReadOnlyList<T>, IReadOnlyCollection<T>, IEnumerable<T>, IEnumerable
@ThePhD Make the ObservableCollection be what contains the data, and pass it around as whichever of ICollection<T>, IList, ICollection, IReadOnlyList<T>, IReadOnlyCollection<T>, IEnumerable<T>, IEnumerable is more appropriate.
Actually, that way shared mutation works fine too (modulo sync bugs and shit).
 
user3010322
5:43 PM
I don't worry about sync. :D
 
user3010322
So I guess the internals of my ObservableDictionary should copy, then.
 
@R.MartinhoFernandes Can I ping you now, is it next week enough? :v
Also god my brain doesn't work, someone verify my set math
 
@CatPlusPlus Ah, thanks. I'm leaving soon, but I'll see about it after.
 
new_items = frozenset(new_field)
old_items = frozenset(old_field)
added     = new_items ^ old_items
removed   = old_items ^ new_items
^ is symmetric difference
 
why.jpeg
 
5:45 PM
I need a diff view for a list
 
Eh I meant the traditionally commutative operator
 
Damn, it's raining.
 
a \ b!
 
I'm once again wearing shorts and T-shirt.
And this morning I decided to get the backup sweater out of my backpack.
"I won't need this anymore"
 
robot, I need to admit
that it is I personally who is controlling the climate against you
when I witnessed you removing the sweater through my closed-circuit cameras, I cackled with glee.
I just wanted you to know that it was me.
 
5:48 PM
@chris lol. That isn't the first time I've seen a copy-paste copycat.
 
user3010322
Well, now my ObservableDictionary copies.
 
@Puppy Oh nonsense! We all know his weather is controlled by a butterfly in Bangladesh.
 
user3010322
I guess I'm all conformant now.
 
@JerryCoffin Yeah, that's why I stuck electrodes in it's brain.
 
user3010322
Hm.
 
user3010322
5:50 PM
... Nah, C#'s optimizer can fix this.
 
@ThePhD C# doesn't have much of an optimizer afaik
(unless you run the native codeine thing whose name I forget)
 
user3010322
Well, if I do something like pass null through a delegating constructor (e.g., MyClass():this(null)
 
user3010322
I think reasonably in the next constructor that checks against null it could just jump to the right branch automagically, right?
 
user3010322
Maybe?
 
maybe :p
does it matter if it doesn't?
 
5:54 PM
That's likely to go away with JIT and branch prediction.
 
user3010322
Not really, just a quirk that popped in my head that I had to quell with a gentle assurance that the compiler can handle it.
 
Django filters can only take single argument :derp:
 
user3010322
But does it support Tuple?
 
@Puppy You got the wrong one though. You've unwittingly been controlling the weather in southern Italy instead of Germany.
 
5:58 PM
No, the template language is incredibly primitive
 
what do I work on now
Haskell game project
or embedded C hardware project
 
@jalf Codeine is a drug.
 
user3010322
Write CSharppe with me. <3
 
somehow I got this two at once.
 
@BartekBanachewicz Becoming a real boy?
 
5:58 PM
@ThePhD Inliner can trivially take care of it.
 
@JerryCoffin As far as I know, I'm pretty real.
people can confirm... right?
 
@BartekBanachewicz HARD CHOICE
 
@BartekBanachewicz I have observed closely--you're clearly integer, not real.
I, OTOH, am definitely complex.
 

« first day (1403 days earlier)      last day (3536 days later) »