« first day (919 days earlier)      last day (4024 days later) » 

11:00 PM
> The library takes std::functions and exposes them to the lua VM
 
@kbok yes, but maybe stress a bit more
 
Xeo
I just noticed my tablet still pings when I thought I closed chat...
 
Well, if you insist
 
@kbok std::function needs to be an implementation detail. Don't put it on the user-facing interface, don't mention it in the docs.
What you want is: specify that whatever(f) works as long as f has an 'introspectable' operator(), and provide whatever<R(A, B, C)>(f) as a fallback when it's not.
 
@LucDanton Sure. It was only used in the article to help explain what the method did.
 
11:01 PM
 
@kbok By the way, maybe hide register overloads, and provide only one templated version, which internally would call make_function and pass it to overloaded register. In that case user don't have to call make_function
 
We'll probably provide some kind of concept for what has to be passed to register_function
 
@kbok 'The library takes std::functions' though.
 
@LucDanton It's a lie. :)
 
I call people out on lies.
 
11:03 PM
 
Xeo
@kbok Damn luars.
 
@LucDanton You know that's not true!
 
@TonyTheLion AHAHAH
That right there, made my day.
 
@kbok Also FTR the Lua API already provides you with a mean of type-erasure via lua_pushcclosure.
 
11:04 PM
So many plinks
@LucDanton We don't want type-erasure though, but quite the contrary.
 
Xeo
err
std::function is type erasure
 
It erases everything but that which we care for - parameter and return types
 
Hiding R(A...) into int(lua_State*) (+ upvalues) is type-erasure, so you want type-erasure.
 
I think @Cat should use this picture moar :)
 
Under the hood register_function pushes a lua_callable_function<R(P...)> that pops parameters from the lua stack based on what the matching callable expects then invokes said callable
 
11:07 PM
I.e. type-erasure.
Btw you can push a function pointer (again, via lua_pushcclosure) rather than a userdata or whatevs.
 
Of course, we must go through it sooner or later. Maybe I'm missing your point?
 
4 mins ago, by Luc Danton
@kbok Also FTR the Lua API already provides you with a mean of type-erasure via lua_pushcclosure.
Stay away from std::function.
Miles away.
 
@LucDanton Mightily impressive!
 
Ah, yeah, the light user data is superfluous
Though I don't see what is so problematic with std::function
 
Xeo
11:11 PM
somebody plink me
 
@kbok If you feel like living dangerously you can stuff a function pointer into a void*, such that lua_pushlightuserdata(L, unholy_cast<void*>(p)); lua_pushcclosure(L, adaptor, 1); works for function pointers.
 
@Xeo why?
 
For anything stateful it's saner to go the full userdata route though.
@kbok Because Lua doesn't understand std::function, you'd perform type-erasure on that next.
(In addition to all the std::function ills that have been reviled over the last few days.)
 
I wasn't there though
 
I'll see if I can dig it up.
 
11:13 PM
@LucDanton which one ills?
 
Xeo
@DeadMG trying to disable plinking when the tablet is locked :s Maybe I'll just turn plinks off
 
Although TBH we're struggling enough with the API to worry about implementation issues right now
 
Xeo
okay, with that, I really gotta head to sleep.
 
16 hours ago, by R. Martinho Fernandes
@ThePhD :(
@kbok I've been writing my own stuff to pass data in and out of Lua.
 
Xeo
@LucDanton It's almost as if certain people don't want to learn...
 
11:16 PM
Since the start of the month I mean.
 
I understand if you had specific deficiencies to point to but the discussion is basically "ThePHD's code sucks" and "Don't inspect callable traits, it's silly"
 
Fair enough, but I won't say any more. It's a beating-the-dead-horse thing to me, I really can't stand it anymore.
Keep in mind that in the context of inspecting functors I said this:
18 mins ago, by Luc Danton
What you want is: specify that whatever(f) works as long as f has an 'introspectable' operator(), and provide whatever<R(A, B, C)>(f) as a fallback when it's not.
 
I completely agree with you on this and told you this is already the case
But you're linking to Martinho's messages, who has a completely different discourse
 
Making it clear that it's std::function that's the dead horse, not inspection.
@kbok Not really. We share the same sentiment on inspecting things.
First time I have not found a superior alternative.
 
I get your point but I still don't know what is dead-horsey about std::function
 
11:22 PM
Yeah I'm not going there anymore.
 
Well, if you feel like linking to some previous conversation at some point in the future, you're welcome
I'll probably bother @R.MartinhoFernandes tomorrow about this. This is sleep time.
 
Do you guys have any web tutorials on C++11 (given somebody knows C++) for a fellow such as meself?
 
no
Well there's the robot's blog.
 
@Pawnguy7 So it is for "such as yourself" or for "somebody who knows C++"? :-)
 
11:28 PM
@kbok I once considered writing something definitive on the topic. I never quite found out how to spin it in a way that wasn't dreadfully boring, so I gave up on that. This is my favourite writing on the topic of not putting std::function in user-facing interfaces. Which is one ill of std::function.
 
@JerryCoffin Very funny. Well, I would say I know C++, but... for example, I don't do all your fancy template stuffs... so... not sure where you put it.
 
And yes, I recommend asking Martinho.
 
@LucDanton Thanks.
 
0
Q: How to create 1 million processes

tedswurfMy goal here is to simply compare performance of creating 1 million processes vs threads (subsequently). each process/thread does nothing, and they should only run after the current one has finished Below is my code, when I compile it, i get several instances of the error -bash: fork: retry: R...

^^ woah...
 
@Pawnguy7 C++11 is not just fancy template stuff, mate. You should try that book list that is fairly up to date as far as I hear.
 
11:30 PM
@Pawnguy7 "fancy template stuff" is mainly used by library implementors IMO
 
No, I meant, for example reading Bartek's Minicraft cod,e I find templates like that hard to follow. Not related to C++11, but a gauge of my knowledge.
 
Bartek is far from a master of the template metamagics
6
 
No. But stuff like that I fall short of. Hard to read.
 
barkteks template stuff is pretty straightforward..
in that code
 
There you go. I am lower than straightforward templates :D
 
11:35 PM
just practice writing some
 
@Pawnguy7 Perhaps you should read Modern C++ Design, C++ Template Metaprogramming. There is more "convention" in templates than difficulties.
 
My template magic has improved a lot since I first came here.
 
Modern C++ Design is great
get that book
and write a few
you will get a good understanding
 
holy shit, my internets so slow
 
Swiftly following on from '1 million processes', there is 'Im making an multithread app where the user adds in 1 ingredient at a time to make a fruit salad'. I'm going to take a few days time-out from the multithreading tab, in an attempt to preserve my sanity. It's full of fruit-loops at the moment.
 
11:52 PM
Anyone COM savvy that can point out any mistakes with a solution?
0
A: How to use HTMLElement class in C/C++ code

Captain ObvliousSince your question is somewhat broad the solution I'm providing it somewhat large but complete and tested. If you already have a pointer to a valid IHTMLDocument or IHTMLElement object you can retrieve the location and dimensions of an element quite easily. The only requirement to get the dimens...

 
@DeadMG But he knows a lot about the magic of friendship.
 
You can have a reference to a literal? What would you do with that? :\
 

« first day (919 days earlier)      last day (4024 days later) »