« first day (788 days earlier)      last day (4158 days later) » 

1:00 PM
Nothing is right in that sentence!
 
Oh, Nothing. I thought you mean "nothing".
 
If I meant nothing I'd write nothing
 
But you refuse do use a different font?
 
I don't randomly capitalise words
It should be fairly obvious
 
1:00 PM
He's a cat, 'nuff said.
 
How about this sentence: "Nothing propagates automatically in Haskell thanks to >>="
 
Keep in Mind you're talking to a German Person!
 
I'll remember to use another font just for you next time
 
The Cat is Polish
 
@LucDanton Right, we have "nothing" and "the Nothing".
 
1:01 PM
Woot, I wrote nothing.
 
so your brain is a quine then?
 
@CatPlusPlus Anyway, back to the original question. Do you think parseInt should throw an exception or not?
0
Q: What is efficient to check: equal to or not equal to?

shubhanshI was wondering, if we have if-else condition, then what is computationally more efficient to check: using the equal to operator or the not equal to operator? Is there any difference at all? E.g., which one of the following is computationally efficient, both cases below will do same thing, but w...

0 upvotes and 12 answers... this must be a very interesting question :)
 
I've switched some code from IO (Either Blarg a) to IO a, I put in trust . parseStuff with trust = either (error "why???") id and the like.
Got tired of fmap.fmap everywhere; actually it was the binds lifted into however many fmaps that got old.
 
@FredOverflow According to boost guidelines, an important question is: Is stack unwinding desirable or not? I think returning a boost::optional<int> may be a better choice.
 
Sounds silly.
 
1:07 PM
@StackedCrooked That sounds like an efficiency reason. I am asking from a pure API perspective.
 
@LucDanton I often use ErrorT and let the monad machinery handle that.
 
@StackedCrooked Nah, I disagree.
IMO the key question is, "If you return a failure value and the API user does not check it, will everything continue OK?"
 
I don't like using IO exceptions for my own errors. For some reason.
 
As a user, it depends on what I expect. If I'm parsing something unknown, where I actually have to seriously handle if parsing fails, I'd rather avoid exceptions and just get an error code or something. If I'm parsing something that I know should just work, simplify the API and throw an exception on failure
 
if the answer is "No." then you can only throw an exception or force the user to pass in an error-handling functor a'la CPS
 
1:09 PM
@R.MartinhoFernandes Do you put IO at the top (bottom?) of your stack, or do you keep that separate?
 
else you risk them simply not checking the return value
 
.NET has parse and tryParse to cover both cases
 
@LucDanton Sorry, I don't know what counts as top or bottom :/
 
woo, let's git bisect some shit
 
error handling functor > tryParse
 
1:10 PM
@R.MartinhoFernandes Ya me neither. Do you put it in though?
 
@FredOverflow of course it would, how else can you tell if it has failed?
 
@thecoshman It could send an email in case of failure :)
 
Something like ErrorT MyErrorType (StateOrWhateverT blah IO).
 
other then some god ugly error message thing that you need to check after every freaking thing that could fail
 
@DeadMG Meh, not really.
 
1:12 PM
@R.MartinhoFernandes Absolutely it is.
 
@R.MartinhoFernandes I don't know, I would have thought that keeping IO apart is better for separation of concerns.
 
if you call tryParse, there's nothing stopping you just ignoring the return value and continuing anyway.
 
I don't mind fmap'ing over IO.
 
it's the "I hope everything goes to plan else really bad things happen" approach
if you ask for an error-handling functor, then you can achieve the same result except that the user has to explicitly pass it, else compilation fails.
 
@DeadMG Just like there is nothing stopping you from passing in a noop functor.
Stop being silly.
 
1:14 PM
@R.MartinhoFernandes True, but then you have to explicitly create a no-op functor.
 
you can't just forget about it
 
Are you serious?
 
It should require effort to silence an error. Accidentally ignoring an error should not be possible.
 
¬_¬ call me whenthis shit is over
 
1:14 PM
And you have to *o your optional, you can't just forget about it?
 
@thecoshman Have you been paying attention at all? :)
 
who said I returned an optional?
 
Riiiiight.
Your whole argument hinges on a crappy interface for tryParse.
Duck you.
 
You're not even DeadMGing right. Get it together!
 
Funnily enough, I'm currently also thinking about how I should handle errors in composite RPC calls.
 
1:16 PM
well, there are a few approaches you can take, but those which say "I just hope that the user duplicated the if code a billion times" automatically go the bottom of the pile.
 
@FredOverflow not really, I just back from lunch, but do tell me, how would parseInt("not an int"); be expected to behave?
 
How about it returned an optional<int>?
 
no
 
What do you mean "no", it's a thinkable solution :)
 
user142019
No, throw an exception from it.
 
user142019
1:18 PM
Or Expected<int>. :P
 
@thecoshman convert the string to binary representation and return as base-10 :p
 
but then you have the check if it is returned a valid value
 
No, I refuse to throw an exception from parseInt, because the majority of strings are not numbers, so it's not at all exceptional.
 
well
 
Um struct noop_handler_type { struct universal { template<typename T> operator T() const { std::abort() }; template<typename... T> universal operator()(T const&...) const { return {}; } } constexpr noop_handler;
 
1:18 PM
@StackedCrooked ¬_¬
 
@LucDanton You can still do that, and then you lift everything to the big stack.
 
@thecoshman Which is a good thing.
 
@FredOverflow Then you have to ask for an error-handling functor.
 
user142019
template<class T>
class Expected {
public:
    // stuffs
private:
    union {
        T val;
        std::exception_ptr ptr;
    }
    bool has_val;
};
 
@FredOverflow Why would you when you can use the puppy's solution?
 
1:19 PM
@DeadMG An if/else is just too simple for you, isn't it? :)
 
@FredOverflow that's it's not what 'parseInt' expects, it expects to be parsed a string that can be converted to a sensible integer value. The exception is 'This string can not be converted to a sensible int'
 
@Zoidberg'-- We can all watch the video, thank you. Also Boost.Variant sucks.
 
@FredOverflow Except you have no way of knowing if there even is an if/else.
 
@R.MartinhoFernandes It just seems like it's the same as IO (Either Blarg a), except that an IO (ErrorT {- dunno what goes in -}) can have more than one kind of error in it.
 
@R.MartinhoFernandes :O
 
1:20 PM
@R.MartinhoFernandes Boost Variant sucks? I thought it was awesome? (I was just considering using it.)
 
@FredOverflow if what?
 
I don't think that's a good example of exceptions. An exception to me is when the Network is down. Maybe I have been writing too many (toy) compilers, but invalid input is the norm, not the exception.
 
@LucDanton You get an IO (Either e a) once you runErrorT.
 
@R.MartinhoFernandes Oh, why the IO?
 
@FredOverflow It's irrelevant if it's normal or not.
 
1:21 PM
@thecoshman if (x) { do something with *x } else { please try again }
 
then by your logic, it should throw an exception when there is valid input
 
@thecoshman Good idea, I will throw an Expection then :)
 
@Zoidberg'-- Also, Alexandrescu is silly in talking about Maybe. No one uses Maybe for serious error handling, we use something like Either or ErrorT.
 
lol
 
@LucDanton Can't get rid of IO?
 
1:22 PM
@R.MartinhoFernandes Alexandrescu probably doesn't know much about Haskell.
 
bleh

try{
parseInt(user_input);
} catch (YouIdiot_DontYouKnowNumbers){
// handle mofo
}
or what ever the exact syntax is
 
@LucDanton In case that is the source of your confusion, runErrorT returns an Monad m => m (Either e a) in the general case.
 
@thecoshman It is depressing how often you feel like getting valid input is actually the exceptional case...
 
@FredOverflow But I think he knows a lot about computer language theory in general.
 
1:22 PM
@R.MartinhoFernandes Thanks. Par for the course for transformers I suppose?
 
@thecoshman And it would not make much sense to have a parseInt without the try/catch around it, right? So why not use an if/else?
 
@LucDanton Yes.
 
@TonyTheLion Have you heard of "C with classes"? It's a ripp off from C++.
 
@StackedCrooked As soon as humans are involved, you're pretty much guaranteed to get impressively ingenious wrong or otherwise unexpected input (patterns)
 
Anyway, puppy, how do you return from the caller in one of your "error handling functors"?
 
1:24 PM
@FredOverflow lol
 
And since software is usually made by said humans, the same goes there, but the predictability tends to go up
 
@StackedCrooked Pity that he can't make an actual language.
 
@FredOverflow because it is not a "if i have an int, fine, else let me just handle it" its "try convert this string to an int, oops, I didn't give you an int did I"
a try/catch is much more semantic, you are TRYING to convert to an int
 
@R.MartinhoFernandes Well, you probably return a default value (which is then returned by parse)
 
@thecoshman But you have to try every time. Not try/catching a parseInt is a serious program bug, imho. And there is nothing enforcing you to try/catch it.
 
1:25 PM
Now you require a meaningless value.
Can you dig yourself deeper?
 
How about Nothing as a default value? :)
 
the other option is some sort of bool ToInt(string value, int& outValue) which starts to get real ugly
 
@thecoshman Not all languages call it try. That's a silly argument.
 
@R.MartinhoFernandes If there is no possible default value, then your operation cannot continue anyway, and an exception is a perfectly good way to go.
 
@DeadMG Or not.
 
1:26 PM
@thecoshman No, the other option is to use a sensible return type.
 
@FredOverflow nothing enforcing you to if/else it
 
@FredOverflow it's only a big if you intend for program execution to recover and continue after a failed parse. It's not a bug to let the exception go unhandled if you just want to terminate
 
@FredOverflow such as?
 
You could simply set a flag somewhere or ignore it.
Yes, sometimes you want to explicitly ignore errors.
 
@thecoshman Hm, right, in C++ nothing enforces you. I'm too spoiled by Scala, sorry :(
 
1:26 PM
@R.MartinhoFernandes You can't pretend that X has a meaningful value when it doesn't.
 
@R.MartinhoFernandes I'm still investigating (right now in fact) where I want to put IO for those paged thingies to be honest. Getting rid of the errors was really more about removing unneeded variables than improving the design.
 
but if your call a function that throws and you never catch it, what happens to that thrown exception?
 
@jalf How often do you want to terminate the program because of invalid user input?
 
if you don't need one, then just make up some default value. If you do need a meaningful value, and you don't have one, then you can't ignore the error and you can't continue.
 
@R.MartinhoFernandes perhaps the worst solution
 
1:27 PM
@LucDanton Always on the inner one. Careful where you put stuff like MaybeT or ErrorT though. Those are not movable at will.
 
@R.MartinhoFernandes but it is more maintainable to have your code clearly show that is consciously NOT handling an error case
 
@FredOverflow any time the input doesn't come from the user, pretty much? If you're reading from a corrupt file, you can't just show a "please try again" message. If you needed the value, and it's not there, you can't really do much more than aborting ASAP
 
@R.MartinhoFernandes Uh, there's no monad stack anymore, it's all IO pureData.
 
@DeadMG We don't get to ignore the error, but you get to ignore the case when we want to ignore the error.
 
for once I can agree fully with the puppy, if you NEED the conversion to an int to work, then you can't simply ignore it failing
 
1:28 PM
I have no idea why I am discussing this with you.
 
@jalf Again, dabbling too much in compilers recently. You want to detect as many errors as possible in one run, there.
 
@thecoshman I am not presenting it as the solution, but as the goal.
 
@R.MartinhoFernandes No. If you can ignore the error, and you want to, then just return some meaningless default value and stick in a comment.
 
Now that's DeadMGing.
 
lol, "stick in a comment"
 
1:30 PM
@FredOverflow It does. Nothing is an exception
 
@R.MartinhoFernandes but simply running code that could return a dodgy value an ignoring it is terrible. If the conversion through an exception, it would force you to explicitly NOT deal with it, which is much more maintainable
 
Let me just say that git bisect is pretty cool :)
 
fuck git :P
 
@jalf or any other vcs that has that (automated)
 
@sehe yep, sure
but I'm using git right now :)
I'm certainly not saying that Git is unique in having this command
 
1:31 PM
PlasticSCM and bazaar had it. I think git is likely the first (because of kernel work which makes this a 'frequent' task)
 
just that it's a cool command
 
@thecoshman Sometimes things are optional, and failures are acceptable. I have a feeling you are considering somewhat specific cases.
 
@LucDanton He seems to be good at that, I guess his name kinda implies it. :P
 
@CatPlusPlus Doesn't Haskell have "real exceptions", also?
 
Haskell is the exception
 
1:32 PM
It's monads all the way down
 
down where?
 
@R.MartinhoFernandes but then your code should explicitly be ok with a failed conversion
 
@FredOverflow You mean IO exceptions?
@thecoshman So what?
 
I don't know, but I seem to recall something about catch in Haskell...
 
Your code always has to be explicitly ok with whatever it needs to be ok with.
 
1:33 PM
Nothing is the most basic exception possible
 
@R.MartinhoFernandes which is another discussion entirely to if the error should be thrown or what else
 
@FredOverflow That's for IO exceptions.
 
It interrupts the flow, it propagates
 
@thecoshman No. Which is a tautology.
 
Isn't the Maybe monad for error handling?
 
1:33 PM
You can catch it by dissecting the value at some point
 
@TonyTheLion Not the best option.
 
@R.MartinhoFernandes I thought all exceptions must be caught in IO, but not all exceptions are IO exceptions? Docs for Control.Exception suggest that the latter are exceptions thrown by IO operations. Hence things like throw vs throwIO.
 
@R.MartinhoFernandes Ok, maybe choose something else than.
 
@LucDanton Oh, well. I meant exceptions within IO :/
 
Ok.
 
1:36 PM
ErrorT is the exception monad transformer.
 
transformer
 
Cat is an echo machine now.
 
How kind of him.
 
Maybe we need a everything is an exception-design :)
2
 
1:38 PM
@StackedCrooked We already have that- you can throw anything.
 
Good point.
 
Exceptions are not magical, they're just automatically propagated values that interrupt the flow
 
But you can only catch things that have been thrown!
I want to catch everything.
And I want inceptions.
 
You can catch everything (that has been thrown).
 
@R.MartinhoFernandes you just have to throw everything then
I don't see the problem :)
 
1:40 PM
@jalf Hmm, reminds me of throw throw throw throw throw throw throw throw throw throw throw throw throw throw throw throw x
 
throw ...;
 
@StackedCrooked How much different is that from a call with continuation?
 
@R.MartinhoFernandes ¬_¬
 
@JerryCoffin I was just spouting nonsense. How is nonsense different from sense? :)
 
call/cc is headache factory
 
1:43 PM
Unless Haskell.
 
@CatPlusPlus ...and you think using exceptions as the form of flow control wouldn't be?
 
ContT isn't that much better ime
 
Actually, I'm not sure if I should use continuation or return std::future in a something I'm working on now.
 
@StackedCrooked what's the difference?
 
@CatPlusPlus Oh, yes, it is. do-notation is the awesomest.
 
1:45 PM
Well, yeah, but it's still a headache
 
do-notation may be my favouritest syntax sugar ever.
 
i wonder if the advice to never assume evil where idiocy might be the cause, might be evil?
 
I still don't know the arrow extensions though.
But mdo is sweet.
 
Arrows are full of magic and unicorns
 
@R.MartinhoFernandes I can't find enthusiasm for it.
 
1:47 PM
@LucDanton You >>= everything manually?
 
@KonradRudolph still around bud? #perl
 
@StackedCrooked uh, dunno, i'm learning. the question was genuine
 
@R.MartinhoFernandes I tend to like =<< better, mirrors . and <$> more nicely.
 
i think the "const" looks perhaps a bit suspect though
 
1:50 PM
@jalf It is. It is also rather tricky to make the 'test script' return precisely the right error codes for it to work, especially if there are commits that won't run the required test for some technical reason
 
STL says "pootter", Andrei says "p-t-r". Seriously, why can't they just say "pointer" like a normal person.
 
Greetings friends!
 
How goes it?
 
@R.MartinhoFernandes agreed
@CatPlusPlus ohhh, magic
0
Q: Adding files to VS2012 project template?

Tony The LionI am creating a VS2012 project template for a C++ console app, that is customized to the companies needs. One of the things is that it needs to have a custom .props file, which I added to the .zip file that VS creates when you export a template based on an existing project. However, it seems t...

I have a question about shitty vs project templates
but I doubt that anyone really has an answer for me
 
1:55 PM
You answered it: shitty project templates are shitty
 
thanks, just the motivation I needed
:P
Motivation level -99
 
@R.MartinhoFernandes Because they are pronouncing (imaginary) conventional identifiers. Last time I checked std::shared_pointer didn't exist
 
@sehe shared_pootter doesn't exist either.
Thank Bjarne.
 
@TonyTheLion: Watch out, if you reach ML -200 you start loosing XP.
 
@R.MartinhoFernandes meh. How woud you pronounce it ?
 
1:57 PM
lol
 
ptr is an abbreviation for pointer
so say pointer
 
@R.MartinhoFernandes ok
 
I pronounce std::shared_ptr as "standard shared pointer".
 
@TonyTheLion woof
 
1:57 PM
you're a bear, not a puppy
bear don't bark
 
"stood shared pootter" gets on my nerves very easily.
 
ohhhh
 
@R.MartinhoFernandes I'm with you on this one, it's 'standard shared pointer' or 'es tea dee shared pointer'
 
@R.MartinhoFernandes because they're not quite normal?
 
@StackedCrooked Word of caution: You'll end up with lisp. Probably with all parens reversed: )apply )lambda x y )+ x y (( 1 -43(
 
2:02 PM
@sehe Sounds reasonable.
@Cheersandhth.-Alf More concrete example. (Well, I guess there is no general answer as to which approach is better.)
 
@StackedCrooked When I load the page, there is no program.
 
Yeah, it disappeared the second time I clicked. I don't know why.
 
Great, IntelliSense stops working if I add a comment here.
lol ICE.
 
@DeadMG "Bad code ID!" /cc @StackedCrooked
 
1
Q: Are Exceptions in C++ really slow

AvinashI was watching Systematic Error Handling in C++—Andrei Alexandrescu he claims that Exceptions in C++ are very very slow. I want to know is this still true for C++98

 
2:06 PM
@StackedCrooked FWIW, I find CPS horrible in any form. Continuations are only nice without the horrid CP style, i.e. stuff like C# async/await, or Haskell's do.
 
^ I think a question that is answerable by reference to a report from the C++ committee, should not be closed as unconstructive or not answerable.
 
@sehe See the next link I posted. (Don't know what I did wrong there.)
 
2:32 PM
that dlib look rather broad in scope... can't be good
 
Just use boost.
 
indeed
 
It is also not C++11-y.
 
though it is starting to show signs of age :P
 
Dunno what it does for GUI.
 
2:33 PM
bah, if you want GUI you want a proper GUI library
C++11-y*Google^wtf/lols
 
@thecoshman You know, C++11-like.
 
@R.MartinhoFernandes I know :p just messing you :P
 
GCC now has -std=c++1y
 
lol, optimistic, even knowing how long it took 11 :P
 
@thecoshman well, the scope is a lot smaller, and there's more work being done in the committee
 
2:37 PM
I'm not sure if frequent small updates is a good thing
 
I'm not sure if "every 5 years" is considered frequent ;)
 
then again, a lot of compilers where supporting '0x' features for a long time
 
but yeah, interesting to see how it turns out
 
@jalf then why is the GCC tag '1y'?
 
@thecoshman What do you mean?
 
2:38 PM
@thecoshman Because 11+5 = 16?
(The current plans are for C++14 and C++17, btw)
 
It's 1y because they'er expecting it to be done in this decade. We're close to 2013 now, so they have 7 years to reach that goal
 
@R.MartinhoFernandes I fail at counting :(
still... whilst it did take a long time for '11' to be 'done', I don't think the wait was that bad. Most of it seemed to be just getting pedantic details sorted. Christ, they still failed to std-ise make_unique! Most of the key features that people wanted to use where being added compilers as the standards where more or less done with them
 
Except a certain one.
 
I think it would get rather messy if ever year a couple more features where added in
but if they are small enough changes, with a bit warning, perhaps the compilers can add them quick enough...
I say compilers, I only really care about gcc :P
 
Dammit, cannot give a separator to istream_iterator
Let's look at boost.tokenizer
 
2:46 PM
If @RaymondChen is around, I'd appreciate an expert opinion on the discussion at stackoverflow.com/questions/13831200/…
 
@thecoshman 11 was mostly delayed by concepts, I think. Herb said he personally thought they delayed the Standard by two whole years on their own.
 
@DeadMG Then it would be C++09, in line with 0x. How convenient.
I suck at editing.
@BenVoigt I don't think I ever saw @Raymond here.
 
@R.MartinhoFernandes Well, I know @-summoning doesn't work from comments on questions or answers to pull in uninvolved participants, so I thought I'd give it a try here.
 
it's probably as much use as speaking his name in front of the mirror three times.
 
@BenVoigt Doesn't work here either unless the recipient was here recently :(
For some value of recently.
 
2:49 PM
Oh well
Anyway, there are experts here other than Raymond. He just carries more authority on win32 topics.
 
s/more/the/ :P
 
for the record, I think Alf is quite correct
 
@BenVoigt We a need flag for "needs Raymond Chen's attention".
 
user142019
Hurray Java class about factories.
 

« first day (788 days earlier)      last day (4158 days later) »