you can't take an Optional parameter there because you're back to square one w.r.t. OR, it has to accept null and null alone and be a better match for null than Optional(T) is.
and it's certainly not polymorphic on what is to be nulled, the Optional(T) is to be nulled.
well, the only reason the previous solution solved the problem is that operator=(null_t) was a better overload when given null than Optional(T) or a potentially-nullable T.
if I want to apply that solution, I need an overload I can pick that is better than all other choices when given null.
then I can define what that means when given null in the implementation.
like, you go out and people start talking about things you don't know or don't care about for all the evening. At some point I just have to intervene in the discussion, no matter what that is and just say something.
@DeadMG This is my idea, i.e. it all depends on the type of the null: coliru.stacked-crooked.com/a/156abd98a250eaa9 Of course I'm in too much of a Haskell mindset here, since Haskell doesn't have something like 'overloaded constructors'. Instead, it simply has different data constructors.
@CatPlusPlus In Haskell I think it can get kinda annoying to always go Just $ actually interesting stuff here, which is why I think that an ADT having an intrinsic "null" constructor might make sense
oh, yeah, yesterday I was reading about type classes and I thought about this: why doesn't Haskell splits the Num type class into, I don't know Addable, Subtractable, etc... so that you can overload +, -, /, etc for your own types where that makes sense?
@CatPlusPlus right, but at least you don't have to invent a new symbol for those operations for data types like a vector (2/3/4d point) or matrixes or whatever can be summed together.
whilst I'm not necessarily a big fan of nullable pointers, I feel like I'd get kickback from a lot of people used to other C-style languages, which nearly universally offer nullable pointing by default.
> If badbit is on in exceptions(), the output function rethrows the exception without completing its actions, otherwise it does not throw anything and treat as an error.
> [C++11: 27.7.3.1/3]: If one of these called functions throws an exception, then unless explicitly noted otherwise the output function sets badbit in error state. If badbit is on in exceptions(), the output function rethrows the exception without completing its actions, otherwise it does not throw anything and treat as an error.
Does that answer your question, @JohannesSchaub-litb?
What a day! No work, Stoke won and the Chelski coaching staff have been told to take Mourinho's belt and laces and check he's OK every 15 minutes throughout the night - he's on suicide watch after the Palace match:)
I was looking into libstdc++ code and was surprised that it sets the badbit on a stream when an operator>> or operator<< is interupted by a cancellation point of pthread (which, if I understand correctly, is implemented by throwing a special magic exception object).
Apparently, the C++ Standard...
like what I would find ideal is something like a python script with some filesystem/globbing tools as well as a dependency/update checker for rebuilding object files
a compiled language with a package manager built-in and only one reference compiler with a consistent interface between versions could use an abstract build system really easily
His final comment asked about "useful illegal programs". I think we deleted the question prematurely. Should have waited until it hit -10<sup>10</sup> and permabanned him
@LightnessRacesinOrbit No no, it's true. He uses localStorage with his own hand rolled concurrency totally missing on locking between checks and assignments rather than using storage events.
> On the Stack Exchange Chat, we have for a long time been using the localStorage as a way for several chat room tabs the user may have opened to communicate with each other, so that only one of the tabs has to talk to the server, and can pass the received data on to the other tabs. This communication is also used for a few small other niceties; e.g. when a user closes a notification in one tab, this is communicated to the other tabs, so they can close this notification as well.
@BenjaminGruenbaum On some projects, but it's waning lately. Certainly C++ has always been my predominant language and it covers at least 95% of my work, to a resolution of approximately six months.
@BenjaminGruenbaum I'd have to study it in detail but off the top of my head are you sure the browser doesn't make this safe? Nobody in the comments seems to have a problem with it
@LightnessRacesinOrbit browser makes it safe - with storage events. That's what storage events solve. Also, they solve the problem he's solving there trivially.
@BenjaminGruenbaum Legacy, mostly. There is a new project I'm working on and I came very close to getting us to use C++11 for it. We even got the toolchains set up on some of the project's dev servers. However I don't want to touch the toolchains on our main build server without a damn good reason.
@BenVoigt I get why people might like PHP better, it's GC'd, dead simple and has lots of shit built in. Also, you pretty much shut down the whole process for every request so no leaks, etc.
@BenjaminGruenbaum No, a few syntax improvements here and there isn't a good enough reason. Personally I want to make the switch, but I can't build a case for management and if I were them I wouldn't go for it either.
@BenjaminGruenbaum $600 > $0. Then someone has to find rack space for it. Then someone has to set it up. Then someone has to manage it and set up backups. We have deadlines; we can't be wasting time fucking around with a new build server when it doesn't solve any existing problem
@nightcracker better templates, better classes with initializers, move semantics, type inference, better standard library.... I don't really think I need to convince you it's more than a few syntax improvements here and there.
All that being said, like I say, I want to get a second toolchain up and running on our existing server, but we need cross-compilers and it's all a bit fragile. I need to wait until we're safely out of crunch time.
@LightnessRacesinOrbit then we have different philosophies, I can totally see myself spending 600$ and a few hours on setting up a server for a better technology toolchain in the long run. I hate needless technical debt. + I think that c++11 makes my life easier.
You don't go reconfiguring your main build server two weeks before product launch. And we were always tight for time on this one. I just can't take it on myself to risk fucking up everybody's work for several days when there is no existing problem. There is no way to sell that to the people that pay my salary.
Besides I've been working nights so don't have time
Just after 1.0 I'm going to get it done, then transition our code for 1.1. All the points of improvement are marked. Much technical debt should be avoided, yes, but that's not a reason to abandon all your important responsibilities in favour of playtime. C++03 works fine for us and has done for a decade.
The practical realities stop me from going crazy installing unstable GCC trunk and every manic compiler extension I can find. They are a good thing!
Plus, I'm pretty much the only one in the team who will grok even half of the new C++11 stuff; I don't really want people attempting move semantics and getting them horribly wrong, because C++11 makes it easy to get them horribly wrong and not know about it
@LightnessRacesinOrbit just the simple stuff like auto and additions to the standard library can make a difference, but I totally get waiting until after a production build
@BenjaminGruenbaum I want ranged-for more than much else. Though some of my iterations are too complex for that, so I want auto for the iterator types, too.