« first day (1609 days earlier)      last day (3330 days later) » 

5:01 AM
null is '' in json, true & false are Boolean. Then you need to_string for objects
 
@Rapptz Do both at once 'Types don't know #'-style?
 
Yeah, for a json library you basically only need from_json and to_json overloads.
 
I worked with json in objective c & Java many times, that's how they deal with json
 
It can be quite powerful with adl.
 
alright from_json idea did not work very well
hm
 
5:04 AM
What was the problem?
 
I tried being too clever
then I remembered you can't overload based on return type
 
Hence 'Types don't know #'.
 
from_json need to be object specific, you need to get values from map/array or combination of the two to construct an object
 
The 'choice' of return type is done by selecting the algorithm.
 
You'll need overloads like from_json(json::obj, T&)
 
5:06 AM
I know you keep recommending types don't know #
 
// plus this
template<typename T>
T from_json(json::object obj)
{
    T result;
    from_json(obj, result);
    return result;
}
 
and I think it's clever and what not
but I just can't really think about it in this way for some reason
 
Deserialization will need a default constructor. I don't know a good way to avoid that.
 
@Rapptz I don’t like boilerplate and it’s a nice way to handle it.
 
the dump(...) interface is similar to types don't know #
if you didn't look at it
except not really
 
5:07 AM
I read the 'primitive' overloads. Where do you build from that?
 
define 'primitive'
 
We choose a core group of functionality, which hopefully is useful enough to build most things out there.
E.g. if I know how to hash/parse/dumb a string or an int, then I know how to do the same for struct foo { int i; int j; };, more or less.
So you have the minimum functionality to handle the JSON types so far, right?
 
Yeah that's what I mean
yes
you can use it to build upon it
lemme work out an example on my machine
 
So, where 'Types don’t know #' plays into this is that you can write a function to 'talk' to the algorithm (hash algo, to_string algo, it doesn’t matter). So for foo we want to feed the algo foo::i, foo::j and bits of bookkeeping (e.g. we want textual description of the type and the members for object notation right?).
I’m actually toying with the idea atm, I was using pretty printing as an algo to test the PoC.
 
well the issue comes in to "what exactly does struct foo { int i; int j; }; represent in terms of data structure?"
 
5:13 AM
It’s Hana-ified static reflection, if you think about it :v
 
hash_append seems to be similar to how boost serialisation library works.
 
@Rapptz Yeah, there are more design decisions available. Should there be at most one canonical description for a type? Can there be more? If so how does generic code find it? etc.
 
ADL hooking is ridiculously powerful as an abstraction technique.
 
yeah and it leads to segfaults
stupid ADL
 
@Rapptz lol
 
5:16 AM
@Rapptz It's a record.
 
ICE or your own?
 
my own!
 
I’ve had stack overflows from careless ADL.
 
I was using ADL on a function that did not exist (yet)
 
Then which function got called?
 
5:17 AM
it was very complicated
I debugged for 2 hours
Mar 3 at 9:25, by Rapptz
@sehe recursion, two files, a function called detail::dump, another called dump the rest is magic.
 
mmmh come to think of it I should probably turn those descriptions into functors, so they can be passed around.
 
Mar 3 at 9:25, by Rapptz
I had recursion that led to a function that didn't exist because detail::dump wasn't found.
 
@Rapptz Dang. When it happened to me the stacktrace was straightforward :(
Remember when I said those times I fire the debugger I’m glad it’s here? :s
Figuring out the wrong function is called leading to a loop that makes the program blow up is one of those times.
 
printf debugging helps here
 
take stack trace kept pointing to destructors
it was very fucking weird
 
5:20 AM
you may have created a deeply nested json::object
 
Yeah so fuck ADL really.
 
Mar 3 at 7:48, by Rapptz
Program received signal SIGSEGV, Segmentation fault.
0x00007ffe5abe3eb5 in ntdll!RtlFreeUnicodeString () from C:\Windows\SYSTEM32\ntdll.dll
very helpful right?
 
The whole trace?
 
It didn't show anything important, I had to step to find out what went wrong.
 
Debuggers can do more than that you know.
 
5:23 AM
I know how to debug :(
 
I actually spent a bit of time figuring out what options I wanted to use so that the resulting binaries were useful in the debugger. It’s why I have -rdynamic in my stuff, even though I keep forgetting what exactly it does.
 
@Rapptz I know :)
 
So far -Og is a toss-up. Fuck <value optimized out>!
 
I use -O0 because -Og still optimises too much
 
heh
 
5:24 AM
@LucDanton yeah exactly
 
-O0 -ggdb3
And Valgrind is often more helpful than GDB in tracking weird bugs.
 
Oh right.
I forgot about the other options to -g
 
But printf sometimes beats them all.
 
I’m fairly sure that on my run-off-the-mill Ubuntu it picks up the sanest and most useful by default.
 
I use print debugging for logic errors
Not for stuff like segfaults and what not
 
5:27 AM
It's good in situations where the wrong function gets called
Because it gives you a visual trace.
 
struct simple {
    int i;
    long j;
    unsigned k;
};

template<typename Algo>
constexpr auto traverse(Algo& algo, simple& s)
-> decltype( algo.template combine<simple>(algo.one(s.i), algo.one(s.j), algo.one(s.k)) )
{ return algo.template combine<simple>(algo.one(s.i), algo.one(s.j), algo.one(s.k)); }
@Rapptz What I have so far
The pretty printing algorithm is anything but pretty though :s
 
// boost serialization would kinda look like this
template<class Archive>
void serialize(Archive& ar, simple& s) {
    ar & s.i & s.j & s.k;
}
Which is used for both serialization and deserialization.
Boost guys are clever.
@Rapptz -O0 optimizes nothing away. This makes it super useful for debugging.
 
O0 can still elide constructors though (IIRC)
 
Yes, it does perform the elisions that are explicitly allowed by the standard.
This probably is not related to the optimizer.
I tested with copy constructors that always throw. The elision will still be performed even though it drastically changes program flow. It doesn't need to care about this because the standard says so.
I think it's a good thing that elision is always done regardless of optimization level.
That makes it consistent.
 
6:00 AM
@ParkYoung-Bae Not a very big deal.
 
@LucDanton I was only adding to the message above
 
He didn't see that.
I wonder why.
> Who are we to judge if a carrot identifies as an apple.
^ lol
 
6:17 AM
why no std::to_underlying ffs
 
6:30 AM
If someone sells me carrot juice in the name of apple juice I will either try to get an exchange for real apple juice or my money back
 
6:51 AM
Lol these comments
1 2 Fizz 4 Buzz Fizz 7 8 Fizz Buzz 11 Fizz 13 14 FizzBuzz 16 17 Fizz 19 Buzz but sideways — Gilgamesh 1 min ago
but sideways with commas
 
lol
 
 
@Mysticial LOL
def get_children(node): for child in node['children']: yield child for grandchild in get_children(child): yield grandchild # open the file and parse its JSON contents f = open('tree.txt','r') size_dic={} for line in f: d = json.loads(line) child_dic={} for child in get_children(d): if child not in child_dic.keys(): child_dic[child["id"]]=1 — Saurabh 43 secs ago
:D
 
You're good at finding this stuff.
 
7:23 AM
@Gilgamesh Specially for you: i.imgur.com/sgOJhRz.pngsehe 21 secs ago
@StackedCrooked in creating weird problems :)
@LucDanton Once. It happened once to me. Probably means I don't use ADL oft enough L: /cc @Rapptz
 
I make a point to avoid ADL, not trigger it.
 
I think ADL is good for APIs though.
Even though I have a love-hate relationship with it
 
ADL has its uses
 
There are things that ADL helps to achieve that are great. But I don’t like the mechanism itself. I don’t think that’s a contradiction.
 
I just had an idea
someone should make a video in a style similar to "if google was a guy" for SO
 
7:33 AM
@LucDanton (me too; it was a tongue-in-cheek way to suggest I don't write complicated enough code to require it often. Which is not true, I'm accutely aware of ADL most of the time and actively use it achieve user-friendly API)
@ParkYoung-Bae ^ indeed
 
@orlp You'll need indian walk-ons
 
wtf happened to skype
it just put an ad on full volume
 
oh, what do you know, I do have a project on google-code
 
@orlp Micro$oft needs more money, probably
 
> Micro$oft
 
7:49 AM
fucking flag spam
 
@sehe thanks?
 
(same string encoded in different bases)
@Mysticial holy fuck
@Mysticial the deleted answers on this question are a gold mine: stackoverflow.com/questions/11165200/…
"Python is really helpful I'm so glad you're putting in the effort to learn it!!"
 
> Me sinto só, mas quem é que nunca se sentiu assim? Procurando o medo de perder então. Respostas, um minuto para o fim do mundo, toda a sua vida em 60 segundos, boto o relogio pra correr em paz... Porque quando estou com voce sinto meu mundo acabar sinto-me o xao sobre os meus pés me falta o ar pra respirar, e se pensar em te perder por um segundo, eu sei que isso é o fim do mundo
 
"i had same error, maybe you use name for children node that not have valid character."
> Where do traffic jams come from? I can't find this answer, anywhere
 
> Where do traffic jams come from? I can't find this answer, anywhere
 
echo bot
 
echo bot
 
What is going on here?
 
What is going on here?
 
8:03 AM
Penis
 
Penis
 
user1804599
@thecoshman yes
 
@CatPlusPlus Is that doppler effect thingy your implementation?
 
@orlp lol all answers deleted and quite a lot of votes on the question
 
@StackedCrooked I am watching Parasyte Ep 22.
 
8:14 AM
@ParkYoung-Bae So, did you join a cult? Or a goth poetry club?
 
@райтфолд bah, just parse left to right
 
@orlp Nice +1 Informative :)
@ParkYoung-Bae :S
 
@ParkYoung-Bae Why is that protected?
 
@khajvah Your name is offensively close to "kJavah"
 
8:16 AM
@wilx Deleted
 
^ the question
 
@sehe your name is offensively close to 'she'
 
Better "she" than "Java"
 
Wow, todays xkcd is very nice :)
2
 
@thecoshman sexism
 
8:26 AM
@sehe no, hyperbole... wait... that's not the word...
 
it's ok
 
man I love to code in python
near-perfect combination of procedural and functional IMO
0
A: merge number by using "-" (python)

orlpThis should work: def ints_to_ranges(l): if not l: return [] l = sorted(set(int(n) for n in l)) ranges = [[l[0], l[0]]] for n in l[1:]: if n - 1 == ranges[-1][1]: ranges[-1][1] += 1 else: ranges.append([n, n]) return ",".join(r[0] == r[1...

 
Did I miss a late night dating session in the Lounge?
 
@rubenvb ;)
 
"@user3683061 If my answer solved your problem you can upvote it and accept it by clicking the checkmark next to it. – orlp " lol
 
8:37 AM
@khajvah gotta get that rep
 
Has anybody ever found a job through SO?
 
I've had several offers
 
@ParkYoung-Bae If you want to say the word repwhore, just say it. It is the one and only correct word. Unlike the bullshit in this question: english.stackexchange.com/questions/226736/…
 
@Mysticial I'm gonna get flagged and binned and banned again
^ wtf
 
@ParkYoung-Bae For saying the word "whore"? I'd say your chance of getting flagged and banned for saying the word "whore" in this room is the same as the word, "fuck".
 
8:43 AM
@Mysticial Damn, you said it too, you are gonna get banned too :)
 
@Mysticial Why can I say whore, fuck, but not nigger?
 
@Mysticial No remember, I was the fucker, you were the shitter.
 
People get offended for the littlest things
 
Honestly, you will get offended if I say chink, right?
 
Not really
 
8:44 AM
@ParkYoung-Bae lol report him for harrasment
 
Are you offended if I say sandnigger?
 
I am not black :)
 
sandnigger, never heard that one before.
 
Sandnigger => arab/middle easterner
 
Not arab either
 
8:45 AM
ah
 
So I'm a chalknigger?
 
makes sense
and snowniggers are Russians?
or Canadian?
 
I have a feeling, we are all going to get banned
 
@khajvah Death is inevitable.
 
@khajvah Unless you are going to report all the room's regulars, chances are slim.
 
8:46 AM
@ParkYoung-Bae Help me plz @ParkYoung-Bae saaaan
 
hahahaha this user invited 25 people to rooms
 
Aditya?
 
So desperate ahahah
It's like "fuck I didnt do shit for my assignment I'm gonna die unless I get someone to do it for me (for free)!"
 
can you flag a user in chat?
not for offensive stuff, just the behaviour of the user itself in a meta format
 
You can only flag posts not a whole user
At least it seems to be like this for me
 
8:54 AM
WTF is this
Congratulations! This was only a test, designed to make sure you were paying attention. You passed.
In the review queue.
 
standard practice
 
I never passed that test
 
then stop being bad
 
ok :(
 
@orlp I checked out your github and you don't seem to license your files.
That kinda sucks IMHO ;)
 
Xeo
8:58 AM
mornin
 
@rubenvb make a pull request adding a licence you want it to have :P
 
@thecoshman Haha CC0 all the things!
 
@rubenvb The ones that are in 'release' state have a license or a public domain disclaimer in the readme.
but I could go over all of them and add a license
 
Do you just write "this is licensed by GPL" or you need to get into some legal shit?
 
Hello
I was wondering if someone could help me word a problem I am having
 
9:05 AM
go on
 
Puppy is the guy for it
 
So I am experimenting with static polymorphism
and
 
He's like the Mac Gyver of the Lounge
 
Puppy is the gift that keeps on giving
you should probably even consider inviting him to a personal room for him to help you
 
9:05 AM
@khajvah GNU has a guide for this. But by and large, yes you do write 'this is licensed under terms so-and-so'.
 
can you point me two making a personal room
to*
 
@Rerito "What will your hero do with just one 'no' and a barely usable 'piss off'" in that sense?
 
@LucDanton Just see this as a little passage rite :)
Anyway @MichaelMitchell just shoot
 
ok
I looked, could not find them
anyways
 
9:08 AM
If your question involves some code (and I bet it does), just use Coliru to share it with us
 
So in my situation, it is very probable that I should be using dynamic polymorphism
but I am dumb so I want to use static
ill use it
so I have this sort of situation
 
Nice formatting
 
now since I have a weak_ptr
sarcasm?
 
Not at all
I really enjoy it
It is refreshing to the eye
 
                            yeah looks fine
 
9:11 AM
ok lol, anyways
since the weak_ptr is there I need a type for it
 
I should format my code like that
 
but I never really use the weak_ptr outside of checking if the object is still alive
so, is there a way for me to not need the type?
 
ICallback() : u_impl_(static_cast<Implementation*>(this))
This line doesn't strike you as something terrible?
 
@MichaelMitchell You should use a weak_ptr<std::function<void()>>.
It’s very important that you do. Right now you have a race.
 
9:12 AM
Anyone of you have issues with the zlib license?
 
What if the pointer expires between line 27 and 28?
 
I guess I should explain a little bit more
 
Don’t think so.
 
@khajvah Don't use the GPL, please. It sucks. Use CC0 or MIT or somthing.
 
9:13 AM
the std::function is from a bind(&A::func, ptr_A)
 
If you have C++14 you can use e.g. [whatever = blah] { … } to properly capture, and hence preserve whatever it is that you need to maintain alive.
 
"including commercial applications" I don't like that line
 
I do not wish to maintain anything I want to detect if the object in the bound function is deleted
which I do with weak_ptr
 
Yeah, with my plan it’s important you take care of that on the other end, too (although not the way I have shown). I’ll make up an example.
 
Is this valid?
template<class Type>
class Callback : ICallback<Callback<Type>>
 
9:16 AM
In the OP’s case, yes.
@Rerito Look up 'CRTP'.
 
CRTP : CRTP<CRTP>
 
> g++: error: unrecognized command line option '-std=c++1z'
:( no std::invoke
 
@LucDanton "What if the pointer expires between line 27 and 28?" I now see what you mean, I should upgrade the weak_ptr to a shared_ptr before I do the function call
 
> The world is slowly converging on ML as the language of choice.
 
9:19 AM
@rubenvb I don't like MIT, it forces your users to include the license with their documentation.
 
@ParkYoung-Bae What?
 
@MichaelMitchell So if you have a weak_ptr to the thing you truly care about, in this case a callback, you can never make that mistake.
 
> The world moves inexorably toward ML
 
@rubenvb Ideally I'd use the apache license, but it's not GPL compatible
@rubenvb I don't know any permissive license with a patent grant that's GPL compatible
 
@orlp Is Apache 2.0 really not GPL compatible?
 
9:21 AM
@wilx Not with GPLv2
 
one of my coworkers contacted me privately to show me an almost finished typesafe lua wrapper
yesterday, by Bartek Banachewicz
suggested an improvement to our Lua API at work
 
@BartekBanachewicz Lundi? Sol?
 
user1804599
ahahahahahaha
 
9:26 AM
@MichaelMitchell I got it the wrong way around, it makes more sense to have the weak_ptr inside the callback than a weak_ptr to a callback. So do something like this in your constructor.
 
user1804599
I had this wonderful idea.
 
yeah, sure
 
@ParkYoung-Bae his own impl
integrated into our Lua API
 
@LucDanton thank you for the suggestion
 
@BartekBanachewicz alright
 
9:30 AM
@MichaelMitchell The idea being that everything is self-contained.
 
user1804599
Defining |> automatically defines <|.
 
why is i passed to func?
 
user1804599
Moreover, who needs infix notation if you have |> and <|?
 
@ParkYoung-Bae used variadics and all that
 
user1804599
xs |> zip() <| ys
 
user1804599
9:32 AM
bukkake
 
@BartekBanachewicz But why not use Sol
 
@райтфолд ...
 
@MichaelMitchell With this setup you wouldn’t call std::bind.
 
9:33 AM
@ParkYoung-Bae maybe he didn't know about it
maybe he was inspired by it
it's a dev from a remote site, I don't know him very well
 
Indian
 
user1804599
Also.
 
also shameless pug an interview with our CEO
 
@MichaelMitchell bind variant
 
9:36 AM
funny read
 
Huuuuuuuge Dicks
 
@MichaelMitchell It’s essentially what you have right now. We don’t need to worry about the type of the weak_ptr though because we hide it in the functor we place into std::function<bool()>.
 
@ParkYoung-Bae cis scum
 
oh
very cool, I can't believe I missed that
I'll try it out
 
Morning.
 
user1804599
9:39 AM
When do you construct DSLs?
 
Usually never
Or when I want to reinvent the wheel
 
@LucDanton Y U bind?
 
@ScarletAmaranth At OP’s request.
 
@LucDanton oh, sorry then; I thought you've gone bananas
 
@ParkYoung-Bae eventually someone will come up with a better solution
 
9:43 AM
> 2015
> using bind
 
morning
 
user1804599
I need to implement topological sorting.
 
@LucDanton Why do you static_cast<void>(i)?
 
@MichaelMitchell Unused variable warning, it’s a habit. I should have left a comment.
 
lol
then could I just do w.expired()?
 
9:54 AM
There is no need to.
 
but in place of w.lock()
 
w.expired() is a race condition waiting to happen.
assuming it actually does what I think it should do based on the name, anyway.
 
?
"checks whether the referenced object was already deleted"
 
ah yes.
expired and use_count: don't use them.
 
@MichaelMitchell Same issue as before.
 
9:56 AM
so if expired passes the test
and
 
you mean, if the race condition happens to execute the way I want it to?
 
then the last shared_ptr is deleted
before I call the function
that is the problem you are refering to?
 
Xeo
yes
 
yes.
 
9:57 AM
just because you call expired() and it returns false does not mean that the object is actually still alive.
 
and by using lock I create my a shared_ptr in that scope
preventing this
I understand now, thank you
 
right.
so you guarantee that either the object was destroyed or it's alive.
and it can't go from alive to dead whilst you're executing
 

« first day (1609 days earlier)      last day (3330 days later) »