« first day (1826 days earlier)      last day (3123 days later) » 

8:00 AM
the behavior is well-specified: it throws an exception if the thread is not joinable
 
Why would you throw an exception when you can not throw an exception
 
(I do think "precondition" should mean "narrow contract" but that's another issue)
 
user1804599
Precondition violation should immediately terminate the program.
 
Am I right to conclude that this comment "Clarifying the rest: the implementation may just write on the same stack address (no ctors required, that was a blunder)" essentially changed the question? It seems to remove the contentious claim that "delegation chains construct a unique temporary object for every link in a ctor delegation chain", if I get you correctly. — sehe 15 secs ago
cc @nishantjr
 
IMO what should be done on precondition violation should be configurable by the app. I think Bloomberg got this right
 
user1804599
8:01 AM
Bloomberg doesn't exist.
 
What has Bloomberg anything to do with this ._.
 
I physically saw Bloomberg walking around
 
@GregorMcGregor Bloomberg has a library for dealing with precondition violations. John Lakos & others designed it and made a proposal for standardization
 
wow. Did you forget about Uncle Bob?
Code is for humans - state your intent. And leave optimization (to {the compiler,later})
 
8:03 AM
I am never asking a question in Lounge again
 
lol
have I done something wrong
 
@GregorMcGregor :S
 
we did it
 
high five
 
that's so mean :)
 
8:04 AM
no seriously, I didn't mean to be disruptive
I just think the try/catch approach makes sense
 
My question was "why not just use joinable, really".
Not what Bloomberg had for breakfast
 
@sehe ¬_¬ you opinion of the man...
@GregorMcGregor lol
 
@thecoshman is that a question? The suboptimal grammar is adding ambiguity
 
@GregorMcGregor and you got an answer, because the join can still throw. The only thing checking joinablecan do for you is spare calling join when you know it will fail.
@sehe it is indeed a question :P
 
@GregorMcGregor welp. At least now you know Santa Claus has a dayjob
 
8:07 AM
@thecoshman The comment seems to imply they only care about joinability
 
and it's bad punctuation, not bad grammar :P
 
user1804599
join should return a Boolean.
 
@thecoshman So, can you phrase it as a question that my feeble mind gets?
 
@sehe your opinion of the man?
 
@thecoshman I think you need to read your own stuff closer
 
user1804599
8:07 AM
Exceptions are lies.
 
Unrelated, it seems Bartek made the news in his local town press after running over an old woman with his motorbike.
8
 
user1804599
Checked exceptions master race.
 
@thecoshman Ah... So trailing r is interpunction. I didn't know that.
 
@sehe never! yeah maybe...
@sehe sure it is
 
@thecoshman I don't have much opinions about the man (I would have to know him well enough). I've seen him air some pretty solid ideas. And I know he's kind of an idol for the lobster
 
8:08 AM
@GregorMcGregor ahhh, you got me :'(
 
@GregorMcGregor I think elyse sort of summed it up: chat.stackoverflow.com/transcript/message/26316719#26316719
 
@sehe him as a 'brand', not personally. Lobster has idols?
 
@GregorMcGregor damnit...
 
10 hours ago, by Elyse
I have a few heroes.
@GregorMcGregor well played
 
oh hey, try this one for strange issues. My phone has decided that it will only do one call or text, then I have to restart it.
 
8:09 AM
@AndyProwl Well, I wouldn't use try/catch and at. I would do a bounds check and use []. lol
 
10 hours ago, by Elyse
In OCD alphabetic order: Peter Gibbons, Tony Morris, sehe, Linus Torvalds, Larry Wall, Geert Wilders.
no uncy bob there
 
so what
you asked "does lobster have idols"
 
well sure, he has idols, but what him idolising bobby old pal
 
@GregorMcGregor I guess it depends, what if the size is too small letsnotendthesentencehere? Do you throw an exception to signal the error? At that point it just makes more sense to use .at()
 
@thecoshman I dislike brands in general, that has little to do Bob Martin
@thecoshman wait. you missed those episodes?
 
user1804599
8:11 AM
@thecoshman Uncle Bob isn't a hero.
 
Gotta admit in this case you probably just don't need to signal any error if the thread is not joinable so the analogy isn't entirely fitting
 
user1804599
More like a funny guy who sometimes says things that make sense.
 
@sehe what's wrong with brands?
 
@Elyse an hero, FTFY
Dec 30 '13 at 0:25, by rightfold
UNCLE BOB! <3
 
it's basically symbolism
 
8:12 AM
@GregorMcGregor damn, I had my trap set up already :D gotta keep it for next week
 
@thecoshman I said I dislike them.
 
at throws a useless exception at any stack frame above.
 
@sehe :O that'll nail the bastard
 
@AndyProwl Exactly, if I want to bubble up the error I'd go with .at, but here we're just swallowing it letsendthesentencehere
 
lol
 
user1804599
8:13 AM
Make at return boost::optional.
 
@sehe which should mean you consider there to be something wrong with them...
 
user1804599
Total functions are the best functions.
 
I'm ok with at() throwing
 
I don't like the idea of bubbling up errors from at.
 
@thecoshman Thanks for informing me
 
8:13 AM
I don't like .at
 
user1804599
Exceptions are unchecked and shit.
 
if I need exception translation I'll try/catch it
 
user1804599
Compiler y u no tell me my code is wrong.
 
It will tell you at runtime
 
@Andy then might as well just throw the right exception frpm the start
 
8:14 AM
where's that pic by fred
 
@thecoshman I'll try to be rational, and always available to motivate my opinions promptly, in the future
 
> you come to me at runtime...
 
user1804599
Pick one:
1) Hate dynamic typing.
2) Like C++ exceptions.
 
The problem with at's exception is that it becomes meaningless as soon as it leaves the frame.
 
8:14 AM
@R.MartinhoFernandes suppress all errors!
 
Also isn't your suggestion a little biased, you explicitly say "pick one", how is that giving people choice?
 
@R.MartinhoFernandes Depends on what clients need to know. If "error" is enough of a signal, what at() throws is enough
as long as it derives from std::exception I mean
 
struct the_program_is_wrong: std::runtime_error {};
 
@GregorMcGregor that took too long to drop for me
 
teehee
 
8:16 AM
seehee
 
for (i = 0; 0 <= i < 10; i++)
a<=b<c does not do what you think it does. You probably want a<=b && b<c instead.
 
@R.MartinhoFernandes I think that a simple "halp fail" is sufficient in most cases really. Certainly better than operator[]'s UB.
 
I think not, and I've wasted too many hours debugging such.
 
user1804599
I always use at.
 
at's failure condition is trivially detectable so in the cases where "help fail" is sufficient you don't need at.
 
8:20 AM
I don't think it's that trivial
 
@R.M that guy on twitter is p dumb
 
it's obviously trivial to check the bounds, but it's less trivial to check the bounds at 9999999 call sites
 
ah, gamedev
 
But "help fail" is not sufficient in those 9999999 call sites.
Of those only a few will use indexing where out of bounds is a normal condition.
 
I dunno, most of the time, "help fail" seems to be sufficient for me
 
8:22 AM
The others will need proper error reporting for debugging.
 
for debugging I'd typically get a stack trace and/or directly apply a debugger
 
I'm not a fan of wasting time with that, and a failed assertion in op[] does the same.
 
apply debugger to segfaulted area
 
Directly to forehead
 
IME stuff like at() throwing are not causes of painful debugging sessions
it's the kind of thing that can be easily investigated by breaking into the unit test that fails
 
user1804599
8:26 AM
Use Haskell.
 
@sehe Yeah, I don't think she really plonked anyone, otherwise she'd only have Joffrey and Lalaland. :/
 
@Andy how do you figure out which test to write?
 
@AndyProwl Terrible creatures :(
 
Assuming perfect test coverage here?
 
@R.MartinhoFernandes I write the tests before
 
8:28 AM
For all the cases? So your software is demonstrably bug free.
 
can't achieve "perfect" code coverage, but very good one yes
 
@ElimGarak That's ok with me. But she shouldn't have tried to pin it on me ("specifically asking to be unplonked" wtf, self centered troll)
 
@R.MartinhoFernandes Not all of them, but bugs are rare enough to not have to base my error handling/signalling strategy on ease of debugging
 
What?
 
user1804599
Write only pure functions that take a Boolean and return a Boolean. Very easy to test exhaustively.
 
8:29 AM
@Elyse How about void functions that take no parameters? ;)
private fun Expression.checkCondition() {
    when (this) {
        is Assignment -> {
            warn("= is assignment, did you mean == instead?")
        }
        is RelationalEquality -> {
            if (left is RelationalEquality) {
                val op1 = left.root().kind().show()
                val op2 = this.root().kind().show()
                warn("a${op1}b${op2}c does not do what you think it does. You probably want a${op1}b && b${op2}c instead.")
            }
        }
        is Logical -> {
 
I don't know what you write but "bugs are rare enough" is not something I'd expect to hear from you.
 
Static analysis is fun. At least for simple cases like this :)
 
@fredoverflow what language is this?
 
I'm saying I never had to spend painful debugging sessions trying to solve an "at() is throwing" problem
 
And then I still don't see how at is superior to the failed assertion in op[].
 
user1804599
8:31 AM
@fredoverflow They are useless.
 
@fredoverflow Neat
 
Assertions can be removed, and without assertion there's no guarantee of crash
 
@R.MartinhoFernandes ICBW but I think the comparison we were discussing initially was not between at() and op[], but between at() and if (in-bounds) op[] else report error
 
guis I really was only asking about that joinable thing ;_;
 
8:33 AM
@fredoverflow a penis based language? :P
 
lol
 
Assertion is a bad thing to do in client interface
 
@TonyTheLion kocklin
 
hi
 
8:34 AM
@AndyProwl Seems pretty... Hard.
 
@Cat not much different from having an exception bubble all the way up.
 
Exceptions can't be disabled and crashing on unexpected error is a good traceable thing
So, yes, it should bubble up
 
exception embolism
 
But if you choose to disable the reporting you can’t really complain about not getting reports?
 
8:36 AM
I mean, where do you catch out_of_range? It's something you'll never want to catch except right there or maybe one frame above.
 
Assertions are for internal invariant checking, and they should be removeable; argument to op[] is not vector's invariant
 
user1804599
@fredoverflow I see a Hitler salute.
 
That’s an argument by decree which is fine but I choose not to live in Catopia.
 
I think it depends. Not all preconditions need to be verifiable by the callee. Narrow contracts make sense sometimes.
 
Anyone else thinks mars attacks aliens sounds like ducks?
 
user1804599
8:37 AM
What is a narrow contract?
 
@Elyse "UB if you don't satisfy the preconditions"
 
@R.MartinhoFernandes It does the same but it also crashes the program instead of, say, just failing that particular request.
 
user1804599
@AndyProwl fuck that
 
so basically op[] has a narrow contract
 
UB is not fine
 
8:38 AM
@Elyse Yeah. Sometimes they are necessary though
 
user1804599
Restrict the types enough such that preconditions become redundant. If that's not possible, check them instead.
 
verifying preconditions could be just too expensive
maybe not even possible
 
which logging library for a small program? c++
 
@fredoverflow oh that does look nice
@Mr.kbok std::cout
 
Assert in op[] just means you need to bound-check yourself earlier to be safe, ignoring bounds checking entirely and relying for assert to fire is a bug
 
8:39 AM
@thecoshman horrible
 
Logging libraries are, yes
 
@CatPlusPlus That’s not a revelation.
 
@LucDanton I wouldn't think it is
 
@Mr.kbok I think @wilx made one
 
Well?
 
8:40 AM
@Mr.kbok log4cplusplus
 
it's horrible
it's a macro singleton fest
 
@AndyProwl IIRC, he didn't make it he just maintains it now.
 
never tried boost.log
 
Yes, I heard that too.
 
@thecoshman oh, ok
 
user1804599
8:40 AM
@Mr.kbok std::function<void(std::string const&)>.
 
user1804599
There's a logger type.
 
@Puppy log4c++?
 
@CatPlusPlus A failed assertion or a uncaught exception don't change the buggy nature of that code.
 
@Elyse lacks level and topic
 
@thecoshman whatever wilx is maintaining
 
8:41 AM
@Mr.kbok log4cplus :)
 
@R.MartinhoFernandes No, but it's not meant to
It's meant to shout at you that the bug happened
 
user1804599
Filtering and transformation? Contravariant functor!
 
Not prevalidating bounds and then doing NDEBUG and only using op[] means bugs go unnoticed
 
7 mins ago, by Luc Danton
But if you choose to disable the reporting you can’t really complain about not getting reports?
Come on, do it right.
 
Assert is not bug reporting tool
 
8:42 AM
Mention how a global NDEBUG is laughable.
 
@Puppy well, I can't deffend macros, but generally logging is one of the few things where singleton/global state is considered appropriate
 
Well not for client code
 
user1804599
wtf no
 
@LucDanton Yes
 
user1804599
don't use globals ever
 
8:43 AM
@thecoshman honestly I don't think so
 
currently the only place where I would accept global state is in e.g. memory allocator internals, and even then, I'm not so sure about that.
 
I prefer my dependencies to be explicit, even for logging
 
@wilx Is it header only?
 
@CatPlusPlus Substitute with 'noticing' instead. The terminology is not essential to the argument.
 
yeah, but I don't want to have to pass around a logging thing for everything that wants to be able to log... but equally, I can see the advantages it can give you :\
 
8:44 AM
@Mr.kbok Of course not.
 
@thecoshman I actually want that, but yeah, might be me
 
I see no situation where disabling client interface checks would be desirable
 
@AndyProwl How would that work? Pass Logger& to every object that might log?
 
Invariant checks are by definition redundant and safe to disable
 
Er, no, they're not.
 
8:45 AM
@Mr.kbok yeah
 
Assuming bug-free software again
 
@AndyProwl That sounds crazy IMO
 
@Mr.kbok I see why you say that, but I like my dependencies on what could make unit tests unrepeatable or slow to be explicit
 
@thecoshman 10% of my code base is quite pretty. The other 90% is pretty... ugly.
 
@AndyProwl Sure, but then you'd remove all global state, ending with a lot of references passed to each constructor/function
 
8:48 AM
@R.MartinhoFernandes Uh if you don't want to disable asserts then it's all the more reason to raise exceptions not use asserts
 
also logging is a feature I test, so Logger is actually never Logger, but, I don't know PointToPointMotionLogger, and its functions are not write(string), but reportFailedMotion(...). This way my tests don't have to check for message substrings or stuff, yet I can verify the function is trying to log the right message in the right scenario
 
@Mr.kbok I probably won't want to log in most completely random functions.
 
Asserts are a development tool
 
@fredoverflow also check for people comparing char*
 
@fredoverflow good lecture ^^
 
8:48 AM
@AndyProwl that does bloat every object with a reference though...
 
@thecoshman Oh no
 
@CatPlusPlus Hey I completely get your position and everything but I think you’re not really arguing it. You’re presenting some things as facts and leaving it at that.
 
I find it too obvious vOv
 
It’s obviously your position, yes.
 
@AndyProwl I'd like to see code that works that way. All logging code I ever saw was morally equivalent to std::cout << "calibrating frobinulators for x=" << x << " and y = " << y
 
8:50 AM
@AndyProwl so basically, for every class, you have a matching logging class?
 
@thecoshman Not every object, but it does add dependencies yes. I just like them to be explicit. I know why you get to dislike it, but if you want to test logging at a non-syntactic level (basically, what I'm saying here) you can't have a "global logger" anyway, at least not without brutally violating SRP (that logger would have to support the union of the logging needs of all classes)
@thecoshman not for every class but yes you got the idea
 
@sehe Wait, it's actually legal and useful to compare char* in conditions, like for (char * p = begin; p != end; ++p)
 
Writer monad <3
 
@Mr.kbok eh, unfortunately I cannot show you that code but IME it does pay off to design like that
 
@R.MartinhoFernandes It’s entirely inappropriate for logging though.
 
8:52 AM
@AndyProwl but can't each class have it's own set of functions for formatting the logging it wants to do?
 
Some people love global variables it seems.
 
@LucDanton Writer? Sure it isn't. But I said "writer" :P
 
I'm not sure this isn't a troll post — sehe 5 secs ago
 
Xeo
@R.MartinhoFernandes Nono, you said "Writer"
 
Most logs in my app look like this
system_error : SophisRunner64@[redacted] (8856.Thread-7536) : [2015/10/14-18:17:01.111] : CSRSqlQueryMC::QueryWithNResultsException - void** , int*() : [SDBC.0005]Error while preparing/executing the request. Throwing an OracleException.
verbose : SophisRunner64@[redacted] (8856.Thread-7536) : [2015/10/14-18:17:01.115] : SSRecalcule::ComputePortfolio() : Portfolio WORKSHEET RELOAD == begin ==
verbose : SophisRunner64@[redacted] (8856.Thread-7536) : [2015/10/14-18:17:01.116] : ::portfolio() : Portfolio Worksheet needs to reload : 0 commodities
 
8:53 AM
@Xeo different accent
 
I wouldn't have logger objects at all
 
@AndyProwl I tend to just want a logger that lets me send a message along with a certain log level. The logger then adds some formatting, dates location etc, and controls, based on the level if it's actually logged or not.
 
It's mostly a pile of crap
 
@sehe Not sure, we have seen plenty of awful code over there.
 
Just prepare a JSON blob with data and barf it onto stdout
2
Something else can deal with it later
 
8:54 AM
@R.MartinhoFernandes Anything that is dual to Either a (ditto transformer version, especially the transformer version).
 
> Throwing an OracleException.
 
@thecoshman the problem is, how do you unit test that? I don't want unit tests to write to the file system, so I'll have to mock out the logging interface at some point. The question is how that interface looks like. If it's log(message), your tests will have to try an inspect the message string to determine if the correct message was produced. If you change the format of the string or slightly reword it, your tests break. I don't want that kind of fragility.
I prefer to have my loggers have explicit interfaces, with logging functions specific for the use case they refer to, and leave formatting as a non-unit tested implementation-detail (sure, you can get things wrong, but you generally end up having all related logging messages in one place, which also helps enforcing consistency and reducing duplication)
 
@GregorMcGregor Sophis does that. It's a POS
 
@CatPlusPlus so stdout is your logger object
 
And it's global~~ (OH NO)
 
8:56 AM
@AndyProwl If you have the time, I'd like to see how it would work in practice, still
 
Well maybe I'd have logger objects to keep common bits for that part of the system (like source name)
 
> I am creating a GUI library to better learn C++ [...]
 
@AndyProwl actually, I do want that. as you seem to be agreeing, the format of logs is part of the interface of the class, so I do want tests to double check that it's logging what it sohuld log. As for the not wanting it to log to file system during tests, shouldn't be too hard to swap out the loggers "this thing actually handles the log writing" with something that just stores to a buffer that you can check and clear for testing.
 
Actually, Writer would do.
 
@Morwenn rip
 
8:56 AM
@Mr.kbok lemme see if any of my toy projects are designed that way - I doubt it, but still
 
@Mr.kbok Same design here
 
@R.MartinhoFernandes Yeah, Writer is pretty much no-frills.
 
@thecoshman I don't agree with "the format of logs is part of the interface of the class". The formatting is an implementation detail for me.
 
Raging, @Andy?
 
8:57 AM
@AndyProwl oh I see what you are saying... you want to just make sure the classes fart out the right data, and not get into details about that format
@AndyProwl yeah, I get you now, I agree with that
 
All the more reason to use JSON or something like that
Don't format your logs
 
@GregorMcGregor really?
 
@R.MartinhoFernandes Not this morning, but the general feeling of empathy is strong yes
@thecoshman yeah
also fart out the right "message", by calling the right function
 
@Mr.kbok For some specialized stuff yes
Not for everything
 
@GregorMcGregor cool
 
8:59 AM
IOW rather than write("I got a touch alarm at position (1, 2, 3)") I'd like them to report_touch_alarm({1, 2, 3})
 
For example orders and trades and perf info is reported through a specific interface, but unusual things are not
 

« first day (1826 days earlier)      last day (3123 days later) »