« first day (1775 days earlier)      last day (3159 days later) » 

12:00 AM
You can’t unary minus a function pointer (one of the many reasons why unary plusses make everything better whereas unary minus is garbage), but you can ruse with -0+.
 
user406009
12:28 AM
@ʎǝɹɟɟɟǝſ Never take a literature course. I am in one right now and it is torture.
 
user406009
Worse than PHP.
 
night
 
I just had a horrible idea to do this horrible trick with the library im writing
 
Satan laughs maniacally in the distance
 
it'll be okay as long as I document it
 
12:40 AM
riiiiight
 
<_<; hush satan no one will use my library anyway
 
user406009
Let me guess? You are using exceptions to pass return values through callbacks with no user data?
 
user406009
void evilApi(void (*blah)(void));
 
its cute you think I expect any of the exceptions I generate to not hard crash the program
actually there's one that can be handled
But no I have a signals and slots system like Qt. I require you to create an object with lifetime control (shared ptr) if you want to give it slots. That way if the object is killed, I don't invoke its slot and blow everything up
But my API lets you pass in any function pointer and any object, so I could tie a slot to the life time of any object
Regardless of wheter or not that slot is a member of said object
Now...
bug or feature? lol
 
@Lalaland I doubt that
Unless it's latin
 
user406009
12:50 AM
@Prismatic Wait, why is that necessary?
 
user406009
Simply take a std::function for your slots.
 
user406009
People can std::bind the method to a std:shared_ptr if they care about lifetime.
 
user406009
@ʎǝɹɟɟɟǝſ You haven't experienced true pain until you've analyzed the "structure of a poem and how it both forms and is formed by its meaning"
 
user406009
At least with PHP you can run the code and get one answer (assuming same php version)
 
they are fn ptrs to members
 
user406009
12:53 AM
That's stupid.
 
user406009
Simply take std::functions.
 
Function pointers and pointers to members are different beasts.
 
user406009
The reason why you want to take std::functions is so people don't need to create unnecessary objects to listen to your events.
 
user406009
I want to be able to type: blah.eventName.listen([]{std::count<<"Blah"<<std::endl;});
 
user406009
One nice API example is std::thread's constructor. Note how it calls std::bind for you, yet still allows you to pass in lambdas.
 
user406009
12:58 AM
/endrant after having to deal with annoying API choices where every single callback needs it's own class.
 
I could add a method to take a std function without needing a receiver
 
moar dispatch
 
user406009
@LucDanton Once we get to GUIs, no one cares about the little inefficiencies in things like events.
 
I also use receiver objects to determine which thread the callback should be invoked on
hmmm
 
Oh, I’m not saying there’s any problem per se. It’s all hanging out there, lurking, skulking. Looming if you will.
 
user406009
1:05 AM
@Prismatic Most UI frameworks I know deal with the issue by only being single threaded.
 
user406009
Which actually works reasonably well.
 
user406009
Cause you can offload work pretty easily to other threads.
 
I want to emulate qt's signals and slots
I really like their model
 
user406009
Isn't qt single threaded for the GUI stuff?
 
(Serious answer: it’s not about keeping track of the layers of dispatch, it’s Occam’s razor taken to design.)
 
1:06 AM
not for qt quick
(separate rendering thread)
 
Uh, is it time for another global recession?
 
user406009
@MarkGarcia Nah, this will calm down.
 
@MarkGarcia Right now it’s Haskell tiem. It will have to wait until that’s done.
 
@MarkGarcia ?
 
@Prismatic Mysticial's Fast Financial Transform isn't working as optimally as expected.
 
user406009
1:10 AM
@Prismatic doc.qt.io/qt-4.8/threads-reentrancy.html claims that most of Qt is not thread safe, ie for single threaded work.
 
its mostly single threaded, yes
 
It seems like the market is drunk and is trying to walk while balancing itself.
 
the rendering stuff isn't though
 
A more interesting question would be: will the U.S. fed reserve still raise the official interest rate in september?
 
user406009
Anyways, per your question, I would have the callbacks all execute on the GUI thread.
 
user406009
1:13 AM
If people want to execute on another thread, they can do that manually.
 
user406009
Cause the vast majority of the time people will want to modify the GUI from the callback.
 
user406009
And you can only do that in the GUI thread.
 
Also personally I think the automated trading/algo trading systems is what's causing the finanical markets to crash more often
 
The system I'm using isnt just for GUIs
its just a general purpose signals and slots thing
 
user406009
I am a big fan of the whole .05% tax on financial transactions idea.
 
1:15 AM
hey scott
 
For example I want to use it for I/O too
 
user406009
@Prismatic Have you checked out boost.org/doc/libs/1_59_0/doc/html/signals2.html?
 
@ScottW maybe in 10 hours time, got work to do during the day
 
Im pretty sure I checked it out before I decided to roll my own
 
user406009
It really seems like vlad spends a lot of his time banned.
 
1:22 AM
Better banned than unemployed.
 
worse to be banned while unemployed
 
user406009
Well he can only get banned while unemployed. Didn't you see the image showing how he stopped participating in stackoverflow when he was employed?
 
but was the employed or banned during that 3 months?
 
@Lalaland ;)
 
user406009
@chmod711telkitty Ah, the angle I never thought of. Perhaps a ban led to employment?
 
1:27 AM
he's purposely unemployed so he could be on SO, how touching ...
 
Can there be a good, possibly self-documenting, choice for the name of the variable s in e.g. ST s a?
Obv. you can pick s to mimic ST but I’m wondering if there’s better.
 
Not bad. Kinda feels like it’s a tag you can or have to pick, when it’s the opposite though.
u for universal ._.
oh hey hdevtools making GVim hang again
 
1:59 AM
anybody here familiar with working through quirks with windbg?
 
$ cabal configure --enable-tests
[…]
cabal: At least the following dependencies are missing:
tasty ==0.10.*
$ cabal install --only-dependencies
Resolving dependencies...
All the requested packages are already installed:
Use --reinstall if you want to reinstall anyway.
._.
 
user406009
@LucDanton The only solution is to nuke the install from orbit.
 
user406009
And try again.
 
user406009
At least, that's been my experience with various "package managers".
 
user406009
(More like package mismanages)
 
2:08 AM
Right, I have to pass in --enable-tests to the install step just like I’ll have to pass it to configure right after. Which I found out about in a random blog post.
This is very convenient and easy to use.
> ttuegel added this to the _|_ milestone on 24 Apr
 
Well it makes sense, you don't want to install test-only dependencies if you're not running tests
 
o okay ._.
@CatPlusPlus See issue.
I’m not saying it doesn’t make sense. I’m saying it’s convenient and easy to use.
 
2:41 AM
@jaggedSpire :(
 
@Nooble :(
 
@jaggedSpire Why have you left the glorious text chat?
 
@Nooble winding down
 
@jaggedSpire WIND DOWN FOR WHAT?
 
@Nooble bed
so delicious and moist
2
 
2:51 AM
jagged jumps up by 20 places in star ranking
 
@jaggedSpire In what way is bed delicious and moist?
 
In 2 weeks, I'm giving a seminar on C++ to about 30 broken using namespace std; programmers
I don't even know where to start
 
cough
 
@MohammadAliBaydoun inb4 flag /cc @Nooble
 
Nab.
You hear that
 
2:52 AM
Yes, I do
 
broken
 
@nabijaczleweli heh
 
Broken, but not beyond all repair!
 
Quite like you
 
@MohammadAliBaydoun Like my template code.
 
2:53 AM
I can repair you with a battleaxe
 
@Nooble Bed is spongy and warm and quite delightful, much like a cake.
 
STARFEST
 
@jaggedSpire I see.
 
Well, shit
 
You out of stars?
 
2:54 AM
Lol.
 
can that happen
 
@jaggedSpire no
 
20 per day.
 
@jaggedSpire yes
20 per room per day
 
God damn it, where are Jerry and sehe when you need them
 
2:54 AM
@MohammadAliBaydoun in bed
 
@MohammadAliBaydoun To do what?
 
@MohammadAliBaydoun Sleeping on the cake-furniture of dreams
 
@Nooble I don't know where to start at all when addressing these inexperienced programmers. I only need 10 to 15 minutes to rush through the basic language constructs, and I need to spend the rest of the 2 hours talking to them about more important things, but the order of topics is not so clear beyond starting with the containers
 
@MohammadAliBaydoun Teaching is hard.
 
@Nooble You know what else is hard ( ͡~ ͜ʖ ͡°)
 
3:04 AM
@nabijaczleweli You.
 
@Nooble kek
 
@MohammadAliBaydoun Eating supper, if you really must know.
 
@JerryCoffin Is it a super supper?
 
@Nooble Pizza from Costco.
 
@JerryCoffin Pretty super to me.
 
3:08 AM
Is there a way to specify restrict on the content of two std::vectors ?
Or maybe the compiler knows that two vectors can never have overlapping memory?
 
@Mikhail Not officially, anyway--restrict is (officially) C-only, not C++.
 
well, two vectors never have overlapping memory, and compiler knows that, so it can pass that info to the vectorizer
also, restrict is not in C++
 
I guess I have an excuse to pass vectors by pointers :-)
and then restrict the pointer...
 
@Mikhail Maybe. They also put quite a bit of work into ensuring that valarray wouldn't have aliasing, but I'm not at all sure any compiler generates code optimized on that basis.
 
@JerryCoffin You can say it's restricted to C.
 
3:11 AM
@MarkGarcia I might be able to type it, but right now I can't actually say much of anything (lost my voice Sunday afternoon). :-(
 
@JerryCoffin Where'd you last see it?
 
@Nooble I haven't seen anything for years. I'm blind, you inconsiderate ass.
 
If I have a function with the signature
```
template<typename... Args>
void Connect(std::function<void(Args...)> fn) {}
```
I was hoping I could call it with a function pointer, lambda, etc and it would just work implicitly but it doesn't :[
 
Ask Robot about doing this (spoilers: don't do this)
 
just force the user to explicitly wrap?
 
3:17 AM
@JerryCoffin I'm a nooble steed, you inconsiderate human!
 
Why the fuck do I care so much about people that'll never use my library anyway? Hmm
I didn't know you could have member functions with the same name that can be templated with different parameters (or not templated at all). Are there any reasons I shouldn't do that?
 
3:39 AM
I hate singletons.
 
you hate writing them?
I don't usually have to deal with them
 
Do you hate extern or singletons more?
 
@Mikhail That's a hard one.
I'll say singletons.
 
I am told that singletons are to avoid weird linking errors that come from extern, the argument doesn't make sense to me...
 
3:56 AM
@Prismatic It’s not related to what you asked, but a function template taking std::function<Sig> (where Sig is made up of template parameters) is not necessarily very helpful. Have you tried calling that template?
 
Is there some clever way to encode max(0.0f,value) so that a branch is avoided?
The lazy solution is to remove the negative bit but that isn't quite the same
 
 
@LucDanton I've tried calling it, seems to work. Maybe I'm missing something obvious?
See the "Emit" function:
http://coliru.stacked-crooked.com/a/f35d9c7f2eec6215
 
@Prismatic simplified
 
I'm lost. What are you trying to point out?
 
Connect(std::function<void(int,int&)>([](int,int&){}));
 
Yes, that falls under 'not necessarily very helpful'.
 
hi
so
iPython
 
@LucDanton Why isn't it very helpful? It's annoying, but it lets you pass a lambda as a callback.
 
It’s hard to review. I can’t tell at a glance what is going on, I have to drill down the syntax to figure things out.
 
4:11 AM
Well I'd like it if the compiler could infer the std::function like: Connect([](int const&,int&){}) or something, but I don't think there's a way to do that. The other overloads of Connect allow you to specify free functions and member functions with a slightly nicer syntax.
Connect(&Thing::Function); isn't so bad
 
@Prismatic I like it
 
@Prismatic How could that work? What Thing is going to be used?
 
That's when you're passing in a static function. I have an overload for member functions where you pass in the object as well; Connect(thing,&Thing::MemberFunction)
hmm
 
@Prismatic Looks the same to me
 
4:23 AM
lol, both of those examples are so much nicer
 
4 hours ago, by Lalaland
People can std::bind the method to a std:shared_ptr if they care about lifetime.
where we were hours ago
4 hours ago, by Lalaland
Simply take std::functions.
(Taking an std::function<void(Args...)> and moving it is morally the same as taking Fn and emplacing it.)
dunno why I went with Fn+move+emplace, force of habit I suppose
 
I don't get why you can provide a function signature to Connect that is different than the template of Signal.

ie you emplace back function<void(int&,int const &)> or something, onto a vector<function<void(int,int)>>
 
It’s compatible.
Maybe you would find this example easier to understand: std::function<long()> f = []() -> int { return 0; };
A lambda returning int is compatible with an std::function<long()> carrier. Would you agree in principle?
 
yes
 
Parameters can also be compatible.
 
4:35 AM
std::vector<std::function<void(Args...)>> list_connections;
//should be void(Args&...)
 
Oh I should have highlighted that change, my bad.
Because an int& parameter is not compatible with int.
 
non-const references aren't compatible with by value
ya
 
Wellp, time to work on them volumetric clouds today. Must wake up first. Shiet.
Also, Until Dawn is a shit geam.
 
render something cool with volumetric clouds
like jupiter
 
4:40 AM
ughhhhhhhhhhhh
 
I need MGSV now. :(
 
@Prismatic that's very compatible
Isn't it?
 
@VermillionAzure try it
 
@LucDanton why?
 
4:48 AM
so you can see for yourself
 
but why?
 
@VermillionAzure error: conversion from 'main()::<lambda(int&)>' to non-scalar type 'std::function<void(int)>' requested :P
 
@VermillionAzure A more hands-on approach is imo more memorable.
 
if the template specifies a value parameter, why doesn't it convert the reference/extract its value?
 
I don’t understand the question.
 
4:49 AM
@LucDanton A function that takes (int, int) is very compatible with (int&, int&), right?
But it's not compatible the other way around, because you cannot always convert values to references
 
We kinda handwaved the meaning of 'is very compatible' because Prismatic and I understood each other. It would be prudent to settle on a definition and more accurate relation though. Did you notice that relation is not symmetric?
I guess you did.
@VermillionAzure Right.
 
@LucDanton So... ???
 
So what?
 
So what?
 
Passing an int& to a function that takes int works
 
4:51 AM
Yeah.
 
Hmmmmm
I'm very confused
Perhaps it has to do with the nature of pointers vs. values?
 
Uhm, references are not point0rz.
 
And the underlying scaffolding that holds lvalue references together?
Whyyyyyyyyy
 
Right. Let’s pick 'is (perfectly) convertible to' as a more precise name. It’s a relation that’s as asymmetric as, well, conversion itself: int source = 0; long dest = { source }; works, but long source = 0L; int dest = { source }; doesn’t because it’s a lossy conversion.
You can in fact do int& source = /*...*/; int dest = { source };. What about the other way around?
 
@LucDanton It doesn't work
 
4:55 AM
Precisely.
 
@VermillionAzure Well, by now you’re almost done.
 
But passing an int& to an int is not perfectly convertible, but for the purposes of substituting references as values into functions that take values, it does work
 
For our purposes it is very perfectly convertible.
 
@LucDanton But the quality of reference is lost. We have extracted the value out of the references, and we have lost information
 
Let me rephrase: int& is 'perfectly-convertible' to int.
 
4:57 AM
Is this why we cannot do this?
 
@VermillionAzure How the hell isn't it convertible? The fact you have a valid int& means it is a direct alias of an int, which a function taking an int can digest. Would you like to qualify "perfectly".
So the fuck what?
 
Doesn’t matter what you want 'perfectly convertible' to mean. We settled on a meaning for 'perfectly-convertible'.
@ElimGarak He has trouble separating words from their meanings.
 
@ElimGarak So why can't I put a lambda that takes (int&) into std::function<void(int)>
What changes that makes this unable to happen?
 
@VermillionAzure You’ve run into variance. Start first with int&() to std::function<int()> to make sure we’ve got a grip on things.
 

« first day (1775 days earlier)      last day (3159 days later) »