« first day (1682 days earlier)      last day (3270 days later) » 

7:04 AM
I suddenly have a C/C++ doubt that needs clearing
> When 0 was send to this fuction, it would return 32. Does this is a bug? I was confused.
alright
> Is c++11 enum class thred safe?
 
Nice info about drowning. Damn television pushing their own knowledge.
@buttifulbuttefly /thred
 
Damn. I was on my way to work and then I realized today is a national holiday.
I started suspecting when I noticed there was almost no traffic.
 
lol
 
@StackedCrooked Here in UK, too:)
 
7:20 AM
nice, let's drink a beer on that :)
@Rapptz I'll start by doing that then :)
 
@buttifulbuttefly I should add more format specifiers.
I'm actually aware of this lol
 
yaay I think I'll land this long-term mentorship
 
I've been stuck on a very basic bug for 30 minutes I think I'm retarded
 
@buttifulbuttefly don't worry you're not alone I think so too
 
Maybe another pair of eyes will see the issue?
 
7:32 AM
@buttifulbuttefly std::string::find doesn’t return an iterator.
oo misread
 
I think your eyes are buggy too
 
@buttifulbuttefly Is the problem that the second doesn’t compile?
 
It does compile, but it seems like the result of the call gets destructed. I get garbage when inspecting the result of the call. It's all fine in the body.
 
@buttifulbuttefly define "doesn't work"
 
Yeah, you’re returning a ref to a temporary.
 
7:35 AM
Where?! There should be no difference between both snippets, no?
 
ah glory of C++ and references
so intuitive
 
hey @StackedCrooked your site doesn't work on the steam browser lol
 
ah
there's a steam browser?
 
@buttifulbuttefly In the nullptr case for sure. I’m browsing the rules for ?: in case that affects the other operand.
 
I'm having an strange problem. I have a C++ program, version 1.0. Given a particular scenario, it takes about 40 seconds to compute. I upgraded to version 1.1, and I'm using boost libraries for a certain new task (but maybe the problem is not related at all with boost). Again, the scenario takes about 40 seconds. Working over Ubuntu server 12.04.

Then, I check at client's machine: Ubuntu desktop 12.04. Version 1.0 also takes about 40 seconds to compute, but then, version 1.1 takes 20 MINUTES. I have monitorized the processes, and my program v1.1 is sleeping most of the time, even when ther
 
7:37 AM
nope.
 
yeah
 
I have literally not one single idea.
ever.
 
I thought it was based on Chrome
not sure anymore
 
nor does anybody else in this chat.
we're all totally idealess.
 
@RomanRdgz Thread waiting on a lock?
 
7:38 AM
@StackedCrooked Embedded Chromium
 
i see
maybe I'll check it out later
 
@LucDanton Yeah that's true for nullptr. God I'm tired.
 
you see in C++ 0 is ephemeral
 
7:41 AM
@LucDanton Yes, but arg?
 
it's a deeply philosophical language
does the 0 exist when you don't look at it
 
@buttifulbuttefly Should explode also.
 
But that's not a temporary aaaaaaaaaaaaargh
 
return values everywhere
vOv
 
Although the temporary comes from ?:, not the subexpression.
 
7:43 AM
I don't understand anythingasljdajklsdsdh
 
@buttifulbuttefly For true ? arg : 0 the whole conditional expression cannot possibly refer to a long that outlives it.
 
nothing new there
 
Well, I suppose the example would be more sensible with a non-constexpr bool but still.
 
@buttifulbuttefly I'm not using threads in this piece of software so, no, no locks
 
7:45 AM
@LucDanton Are you telling me ?: creates a temporary
 
Yeah.
 
The only way that auto& ref = c ? x : y; can work is that both auto& ref = x; and auto& ref = y; are possible. Following me here?
 
Yes, surprisingly.
 
but you still want c ? 0 : 1 to work
So what to do you if have c ? x : 1?
 
7:47 AM
copy the shit out of x
terrible
 
Righto. Then auto& ref = c ? x : 1; won’t do, and auto const& cref = c ? x : 1; does but it’s on borrowed time.
 
Well I Learnt Something™. Thank you Luc®.
 
I don't know what you're doing, but it's all wrong!
 
oh well, derpstorm pushed his hlsl parser on GH
if you take all of his dependencies on his own code into account, I think the Haskell + Parsec solution would be around 150 times shorter
 
@BartekBanachewicz brevity is not the only concern :P
 
7:51 AM
the sun shines
the sky is blue
water boils at 100 degree celsius in 1 atm pressure
@thecoshman anything else to add to "Well, it's fucking obvious" list?
":P"
 
CD Projrekt is rekruiting BTW
Oh and hey @Bartek do you like Elixir and other Erlang-based shit
 
@buttifulbuttefly not here vOv
 
Don't wast time when Fartek get's on his Haskell horse
 
@BartekBanachewicz In Krakow (whatever the spelling is)
 
@buttifulbuttefly I don't know Elixir/Erlang, but I guess they're nice
 
7:53 AM
@buttifulbuttefly craic-of
 
@buttifulbuttefly Kraków
 
Krakòw
 
oops~~~~~~
 
anyway, that's way too south
 
7:54 AM
Does json::value really have a nullptr constructor btw?
 
@Rapptz Shame on you.
 
yes
why
 
It's very useful
 
json has the concept of null
?!
 
7:55 AM
you could've introduced json::null/json::null_t vOv
 
I don’t know, doesn’t feel right :s
 
@Rapptz did you implement std::fixed already I'm willing to donate up to 1 Cicada Gratitude Token
 
@Rapptz Do you also do the same for Lua’s nil?
 
playing vidya
 
limited time offer
it's ok it's not urgent I can wait 11 minutes
 
7:56 AM
@LucDanton I might have preferred it to be explicit.
 
@Puppy doesn't help the fact that nullptr isn't a JSON value
it's still abuse IMHO and I think that's what Luc was aiming at
 
It's fine
 
but since Luc has me plonked I can't even ask whether he agrees with me or not
 
well, null is a JSON value and nullptr basically is that, so it pretty much is a JSON value.
 
@Puppy that's completely not how you should do it
differentiate things on type level.
null isn't nullptr, even if they are both used to represent nullability in respective contexts
and nullptr wasn't made as a generic, use-everywhere null token
 
7:59 AM
too bad
 
I don't care what it was made as
it serves that purpose quite effectively.
 
@Puppy so does 0.
 
no it doesn't.
 
vOv agree to disagree then.
 
0 has that whole "I'm used as null but really I'm an int" thing going on
 
8:01 AM
nullptr has exactly the same category of problems, at least when you approach it analytically
I get that in practice the magnitude of the problem might be less present
 
no it doesn't
 
I see that people are starring random stuff today.
 
and here was me thinking that nullptr_t was a clearly distinct null type that pretty much exactly indicated that the value was nullptr regardless of the situation.
 
inb4 star
 
@Puppy if you create a specific nulltptr_t overload you might as well just put in empty parens, no?
 
8:02 AM
no.
 
what's the difference in this context?
 
there's clearly a semantic difference between accepting or being null, and default construction.
one of them is the user explicitly deciding that you should be null, and the other is stupid.
 
I don't see anything wrong in a JSON value constructing to null by default
it's a valid state for that value.
 
that's because you're a moron with insufficient experience
:P
the problem with JSON value constructing to null by default is that it's a pointless default
there's no reasonable expectation at all that some random function taking a JSON value can accept null.
 
@Puppy is 0 a pointless default for an int? How do you assess that?
 
8:04 AM
@BartekBanachewicz Yes, it is a pointless default.
 
I sort of agree with Bartek, nullptr is not "a T that has no defined value"
 
@Puppy every function taking a json value has to be able to take null
if it doesn't, it's broken
 
@BartekBanachewicz I completely disagree. Preconditions?
 
@Puppy null is a valid value of a json value type.
if you don't operate on json value type, don't take it
 
just because you take a T does not mean that you can accept literally every possible T that could ever exist.
 
8:06 AM
if you take a concrete type T, you have to accept every value, especially in a pure context like this one
if you don't, your function isn't total and non-total functions suck.
 
look what you started @butt @luc
 
they're pretty much a fact of life
 
anyway I just died in game
 
@Puppy so is shitty code. Your point?
 
ok then let me rephrase that
 
8:08 AM
@Rapptz No, you’re the one that wrote the constructor!
 
non-total functions are pretty much a fundamental requirement of all programs.
without that you could never implement even something as basic as division.
 
@LucDanton I'm not going to change it :v
 
@Puppy div :: Int -> Int -> Maybe Int
 
Feature request: moar formatting and also .as_or<int>(default_value)
 
it's implicit because of easy constructibility
 
8:09 AM
I see
so the user should instead explicitly check the result of every division?
 
@Puppy I presume you've never heard about monadic composition?
 
I have but I don't see that it permits you to dodge situations like this one
 
@Puppy then you don't understand it well enough.
 
@Rapptz Sure. I’m just keeping the joke running.
 
8:10 AM
this is no different to shitty error codes
 
@Rapptz Should I open GH issues
 
ok then, how about something like foldr?
can't accept infinite lists- non-total.
 
@Puppy That’s because you are in a non-lazy setting, silly.
 
pretty sure that foldr can't accept infinite lists either way
 
8:12 AM
@Puppy yeah no
 
@buttifulbuttefly if you want, I'm just playing vidya atm with my friends
 
mind filling me in on why the nullptr constructor is bad(tm)?
 
that's a strange example
sure looks to me like 1,2,3,4,5 is the left side of [1..]
 
@Puppy Make your own Mr. Goalposter.
 
8:15 AM
@Rapptz I'm happy with it personally.
 
16 mins ago, by Bartek Banachewicz
null isn't nullptr, even if they are both used to represent nullability in respective contexts
 
nullptr is null.
 
groceries
 
It's clearly not, but if you want to insist, well, it's your library.
 
What do you think std::nullptr_t is?
 
8:16 AM
it's a type of nullptr
 
And what does nullptr represent?
 
nullptr is specifically a pointer that isn't pointing to anything
 
@Rapptz a value of nullptr_t type that can be used to represent a null pointer safely.
 
nullptr pretty much exactly is "null but we already had a null that was shit so we had to call it something else"
 
I'm glad I started this very interesting debate
 
8:17 AM
I'd agree it's abuse to use it as a general purpose 'null' value, but I don't have a problem with that.
 
you guys have very weird definitions of abuse
 
you, on the other hand, have a very interesting approach to type semantics
 
why do I have to reinvent my own nullptr for my library when the standard provides one that denotes a null value
anyway game started
 
@Rapptz I pretty much agree.
 
@Rapptz I am not going to repeat myself.
 
8:18 AM
typed null is a nice thing. a null int does not equal a null string
 
the only problem presented here is the implicit construction, iyam
 
nullptr is typeles
 
@thecoshman it's not. It's a value of nullptr_t, but has explicitely created pointer conversions
so, all in all, it's a hack.
 
null Json::Values also lack a type (in JSON)
 
nonsense.
 
8:19 AM
well
ISTR something about the type of null
 
Null is a valid value of the type json::value
just like Nothing is a valid value of Maybe
 
json::value is not a JSON value.
 
that's an interesting point
 
it's a C++ type.
that holds values in C++.
it represents values in JSON which is a different thing to actually being one.
 
@buttifulbuttefly there's as<T>(default).
Does that do what you want?
 
8:21 AM
@Puppy so clearly it should choose semantics different from the original json value for whatever reason
 
If the type isn't T then it returns the default.
 
@Rapptz Yes, thanks, not sure how I missed that.
 
@BartekBanachewicz It's only operating in a completely different language.
 
@Puppy that hardly matters. C++ can well express what a JSON value is. You're trying to change that expression into something else without, IMO, justifying it enough.
 
you're right, it completely can express a JSON value.
including a JSON value of null.
but that doesn't mean the represented value has a type of json::value.
 
8:23 AM
Is using std::vector<json::value> to represent a json array abuse of std::vector?
 
since json::value is the destination type and not the source type.
 
Should I make my own type for that too?
 
dudes, you are so wrong here, clearly you should just use optional<json::value>
 
@thecoshman no.
@Puppy is a, pardon me, what?
 
@Rapptz oh of course.
 
8:24 AM
@Puppy I didn't get that either.
@Rapptz that's an interesting point
 
lol
 
I think a weak typedef could be enough, though.
 
Heh, json::dump(std::cout, ...) fails on VS2013, could not deduce template argument for '__formal'. And json::dump_string(1) fails with ambiguous call to fpclassify
 
wot
 
That way you point out it's a JSON array, but OTOH keep it obvious that you can use it just like std::vector
"tagging" the vector type in a way
 
8:26 AM
@buttifulbuttefly idgi :(
 
if you wanted different interface or guarantees then you'd need to wrap the vector I guess.
 
how?
 
killed in an accident at age 86
 
@Rapptz I have no idea
 
I won't lie
 
8:28 AM
@buttifulbuttefly fpclassify is a well-known issue
 
json::dump is the definition of ugly
It took me forever to get it to compile in gcc.
So in a way I'm not surprised
 
__formal must be some kind of compiler innards
urghrghr
 
I keep dying in game.
:(
 
which game?
 
Insurgency
 
8:33 AM
does emacs rock?
 
hmm, I wonder if Ceylon's flow typing could work with dependent types /cc @fredoverflow @rightfold
consider:
fnA (json::value a) {
    if (a) return a else return json::value("something");
}

fnB(json::value<reification - not null> a) {
    print(a);
}
if it can unwrap by if, I suppose dependent typing engine could use that to construct refinement.
thus having the cake and eating it. Having a full type at fnB interface (so what @Puppy wanted) but also a static null verification.
OTOH I am still not sure if I like flow typing
 
What's flow typing
 
@buttifulbuttefly Maybe<int> m; if (m) { /* m becomes int here */ }
 
oh. didn't know it had a name.
 
Ceylon manual uses that name and it kinda stuck I guess.
 
8:40 AM
why do you not like it?
 
it feels like a language hack compared to what monads offer TBH
something to make "optional" more useful, but still not generic enough.
 
hmmm I disagree
 
> Bartosz Milewski
Hello Haskell propaganda
I think "flow typing" is quite nice.
 
@buttifulbuttefly why don't you argue with the points he made instead of attacking him?
 
8:43 AM
it's less fun
 
user1804599
@BartekBanachewicz I don't know Ceylon.
 
Also it doesn't work only for optional
 
tbf Bartosz makes a good point
 
It can be used in a myriad of contexts
 
user1804599
@BartekBanachewicz refactoring nightmare.
 
8:44 AM
@buttifulbuttefly ok, so how would it look with either?
 
if (ptr != null) { /* can use ptr as a reference here */ } | if (val >= 0) { /* can use val as unsigned here */ } etc
 
@rightfold how is Mill development going?
 
// this is still fine I guess
Either<a,b> e;
if (e) {
   // e is b
}
else {
   // e is a
}
 
user1804599
dat brace style
 
@buttifulbuttefly What if you had Either3<a,b,c>?
 
8:46 AM
match, and within each branch the deduced type is the one of the branch guard
 
@buttifulbuttefly if you can pattern match, why do you even need flow typing?
 
the type in the branch isn't deduced, is it
 
    case m of
        Just a -> print a
        Nothing -> print "nothing"

    if (m) {
        print(m);
    } else {
        print ("nothing");
    }
 
user1804599
In Scala you can do for (a <- m) { println(a) } or m foreach println.
 
user1804599
Oh wait you want to print nothing as well.
 
8:48 AM
@Rapptz Let’s put it another way: why nullptr? Why not nullopt?
 
user1804599
println(m getOrElse "nothing")
 
@LucDanton C++11.
 
What if it existed then? Which of the two to pick?
 
Probably would have been better.
No ptr in the name.
 
@LucDanton oh completely forgot about that. WHY OH WHY do you plonk me if you agree with me in most of the cases in those stupid arguments even if I am more extreme god this is so frustrating
 
8:49 AM
It has opt instead.
 
Yeah a shame.
But better than ptr I guess.
 
@Rapptz Now pretend you’re the designer for C++ optionals. Do you roll out nullopt or co-opt nullptr?
 
@BartekBanachewicz uh I didn't mean deconstructing match, more like chained if/else?
 
You can't do nullptr because it's valid for optional<int*> (even if that's silly)
So a silly question tbh.
 
user1804599
I think flow typing makes it hard to reason about code since it's pretty much implicit conversions.
 
8:50 AM
@Rapptz Can I do json::value("hello")? What does const char* c = …; json::value(c) do?
 
user1804599
Also fuck Booleanness for non-Booleans.
 
I don't know I like restricting types when there are guards
 
@LucDanton std::string.
 
@Rapptz What is that an answer to?
 
@buttifulbuttefly my point is that it's, I think, universally better to use pattern matching. I don't see any benefits of flow typing, sans perhaps easier implementation and looking more familiar to say C++ or Java developers
 
8:51 AM
The latter.
 
I'm going to read "plonk" as "fuck" from now on.. it will certainly make things more interesting/funny.
 
@LucDanton json::value("..."); or const char*.
 
@BartekBanachewicz Not disagreeing with that, but I think flow thingy is a little broader, no? (see my previous examples)
 
It converts to std:string.
 
So const char* c = nullptr; json::value(c); and json::value(nullptr) have different effects?
 
8:52 AM
Yes
game started
 
@Rapptz That’s the same situation as optional<int*> (disregarding that std::string blows up on nullptr).
 
@LucDanton because null was taken
 
@Rapptz Ultimately I don’t mind that you do use nullptr ('Shame on you' was a joke), but you wanted reasons for not sticking with it. In which case I can point you to the nullopt debate.
 
there's no need to distinguish between the different kinds of null explicitly at the null type level because the user can already do that whenever he wants.
I would totally use nullptr for optional and drop nullopt.
 
@buttifulbuttefly Oh it's certainly broader than just optional, but if you move out of it then if starts making less sense imho. And the chained if-else you propose just look ugly, don't you think?
if you want if to only be used in those small cases, I say it's an unneeded exception
 
user1804599
8:55 AM
Get rid of if.
 
user1804599
Pattern match on Booleans!
 
@rightfold was typing that :)
 
same difference
 
user1804599
Fun-fact: Erlang has no if, only switch (true) and it's called if.
 
I think switch on booleans makes sense
 
8:56 AM
@LucDanton I don't think they're the same thing.
One is nullptr_t the other is const char*.
But that's just my opinion.
 
6 mins ago, by Rapptz
You can't do nullptr because it's valid for optional<int*> (even if that's silly)
 
I'm talking in the context of valid types passed to json::value which is a sort of variant.
 
all types are sort of variants
 
@BartekBanachewicz Doesn't matter if it's valid for T.
 
@Rapptz Did you really think I missed that?
 
8:57 AM
if the user wants T(null) he can just write T(null).
 
user1804599
Get rid of implicit conversions, problem solved.
 
@LucDanton Nah.
 
@Puppy Does optional<int*> o = nullptr; produce an empty optional or an optional with value nullptr?
 
user1804599
Also get rid of null pointers while you're at it.
 
@BartekBanachewicz Obviously an empty optional.
 
user1804599
8:58 AM
No, that's not obvious.
 
user1804599
It's completely obscure.
 
user1804599
Never write such code.
 
@Puppy how do you construct an optional with value nullptr?
 
you mean, a non-empty optional holding the value of T constructed from nullptr?
 
does optional<optional<int>> x = nullopt; create an empty optional or an optional with an empty optional
 
8:58 AM
@Puppy yes.
 
opt = T(nullptr).
 
user1804599
Also exercise extreme causion when using optional in generic situations as it will easily break horribly.
 
@Rapptz nulljso doesn’t look right, does it?
 
simples
 
can't write that for T = int* though
needs static_cast
or type alias
 
8:59 AM
and this is a problem because?
 
I'm not saying it's a problem
 
oh noes a static cast, oh noes a type alias, oh noes might need to write a convenience factory function?
 
I suppose it could be very error-prone
 
alright done playing.
 
user1804599
Don't make optional implicitly convert.
 
user1804599
8:59 AM
It's just incredibly stupid.
 
@LucDanton The type json::null is an alias to nullptr_t.
 
with nullopt there's no problem
 

« first day (1682 days earlier)      last day (3270 days later) »