« first day (1341 days earlier)      last day (3623 days later) » 

Xeo
9:00 AM
template <typename T> struct ReturnType;

template<class Ret, class... Args>
struct ReturnType<Ret(Args...)>
{
   typedef Ret type;
};
 
This is all fucking performance 101. If you care at all about the performance of your code, you need to find out how your code behaves. Not rely on cargo cult "someone on the internet said that X was faster in a sort-of-similar situation, so if I do something similar, surely the performance gods will smile upon me"
 
Xeo
ASKLG:IGJ:KG
 
@R.MartinhoFernandes Okay, you go ahead and implement them without overload operators changing their meaning to "some random symbol"? (I'm pretty sure you know what you mean, but you're certainly not making it clear to me)
 
@sehe At the syntax level? I believe it's really, really well crafted there. And the insides using virtual calls and stuff are gone in X3, so I don't see "a lot" to dislike about it.
Unless you are a crazy C programmer who gets a heart attack when he sees >> used for anything but shifting etc.
 
user1804599
@Ven Is there any quirks to watch out for when defining non-enumerable properties on random objects in JavaScript, apart from name clashes?
 
user1804599
9:00 AM
Wait, I guess I could use symbols instead of strings.
 
@Griwes Oh I do. I guess it's because I use it a lot.
Yup. That's me.
Not
 
@sehe You can build expression templates for addition with +, or expression templates for something else with +. Being an expression template doesn't really matter for what meaning you attribute to it.
 
@sehe Yeah, might be that. :P
 
@R.MartinhoFernandes Oh. Yeah. That's kinda obvious in hindisght. Thanks
 
Ven
@rightfold not OTTOMH, but I'm pretty bad at JS
 
user1804599
9:01 AM
I could use that to implement single-dispatch free functions without instanceof.
 
Ven
@rightfold mmh, that's an interesting idea
@rightfold ... which will provide terrible, terrible performance
 
user1804599
Uh, and instanceof won't?
 
@Ven You are talking with rightfold, he doesn't care about performance.
 
Ven
Hash lookup vs instanceof ? I'll bet on instanceof.
@Griwes Rightfully so sometimes, but there's always a limit
 
user1804599
@Ven For terrible or good performance?
 
user1804599
9:03 AM
I have no idea what you are talking about.
 
@Ven He doesn't care about it at all.
 
Ven
@rightfold for good.
 
@nightcracker For what it's worth, I would expect the compiler to usually optimize out the iterator dereferences, by common subexpression elimination so it would make no difference. But I have no way of knowing whether that occurs in your particular code, or if something in it trips up the compiler. I also have no way of knowing if all the compilers you support are going to do it.
 
Ven
you want to have, i.e.

`var fn = {"String,String": function (a, b) { ... }}` ?
 
You can rant and whine and beg and swear and insult me all you want, but we don't have any information to give you, other than what we think the compiler is likely to do. But if I were you, I'd want a lot more hard data than that.
your strategy still boils down to "I don't have enough information, so I'm going to ask people who have even less". That is a dumb strategy. ;)
 
user1804599
9:06 AM
const someMethodInternalName = new Symbol();

String.prototype[someMethodInternalName] = function(...) { ... };
RegEx.prototype[someMethodInternalName] = function(...) { ... };

function someMethod(object) {
    return object[someMethodInternalName].apply(object, [].slice(arguments, 1));
}
 
@sehe Anyway, this leads once again to my rant about not having algebraic structures manifesting themselves in the language or library, which leads me to Haskell's broken Num.
 
@jalf Let me do one final attempt
@jalf you miss the subtle thing I was asking
 
Ven
@rightfold Oh, uh, you want to have function dispatch on the types ?
 
I wasn't aking whether the compiler was optimizing out the dereference - I have no worries about that
nor control
 
user1804599
@Ven Yes, on the data type of the first argument.
 
Ven
9:07 AM
@rightfold That seems pretty restricted for functions of more than one argument.
 
I asked - and I quote - if it was a good *idea* to move items from some potential heap iterator into a local variable
 
@nightcracker Yes? And how would we know?
 
I am 99% sure the answer is yes, and I was asking people more knowledgable than you, like Mysticial
 
"good ideas" are context dependent. What's a good idea in one situation might be a pretty awful one in other cases.
Knowledgeable of what?
Good ideas?
 
9:09 AM
because they would, 99%, tell me that the compiler has no way of knowing that *p will change between two dereferences
 
@jalf Of all the stuff he didn't tell you!
 
Hey @Mysticial, I didn't realize you were an expert on good ideas
 
> "Off with their heads"
Hehe. Dat reference
 
therefore it will cause a lot of memory accessess
 
@nightcracker No, they would tell you that whether or not the compiler can know that depends on your actual code
 
user1804599
9:09 AM
But I think I need Object.defineProperty because otherwise it will be enumerable, which I do not want.
 
this is a library
 
@R.MartinhoFernandes ROFL
 
there is no actual code
 
wut. that's a bug free library then!
 
lol
int main() {}
 
9:10 AM
Your code is so performance-critical that it doesn't even exist`?
I agree, that does make it hard to profile
 
But I'm sure every compiler optimizes it
 
Here's my suggestion, then. Don't write any more code than you have now. It's already as fast as it's ever going to get
 
Ven
@R.MartinhoFernandes you must mean auto main() -> int {}.
 
 
9:11 AM
Of course, there's another way you could look at it: if performance of this unwritten and unmeasured code is so incredibly important that you can't take any risks, and if using a temporary variable is at worst no slower than not doing it, and you're 99% sure it will be faster, then where is the downside? Why do you need to know whether it will be faster or just "as fast"?
 
FlatBuffers seems nice.
 
user1804599
Oh, properties named by symbols are already not enumerable. Neat.
 
@jalf what if I fucking told you that "is there a downside" is exactly what I'm asking?
hence "is it a good idea" or "are there any hidden pitfalls"
 
@nightcracker What if I fucking told you that whetehr or not there is a downside fucking depends on the fucking context?
 
Xeo
9:14 AM
AJKLSGHJKAGH:A
friggin enums
 
then give me context lol
 
What if I fucking told fucking you that the fucking code that the fucking compiler generates depends on the fucking source code you fucking feed it
 
when writing generic code you're interested in ALL contexts
 
@nightcracker No, you are interested in the context that your source code provides
ITT @nightcracker doesn't understand his own unwritten code
 
that's quite an achievement
 
@jalf that's not context
 
@nightcracker Yes it is. it is the context the compiler deals with
 
@jalf context include, for example, platforms like ARM, RISC, etc, which I can't even test
 
You're dereferencing an iterature, sure, but that iterator came from somewhere, and the dereference is surrounded by other code which does this and that, and all of that controls what the compiler can deduce about yourcode
@nightcracker No.
Those things are interesting too, sure, but the compiler front-end doesn't really give a shit. It looks at your code and optimizes that as much as possible.
 
9:17 AM
@jalf what? of course it matters
 
Later on, sure, when allocating registers and picking the instructions to emit, it looks at the architecture
 
Ven
@Xeo You can just declare defaults before hand, then you don't specify them when you actually declare the templated class ?
 
I don't think supporting platforms you cannot test on is a good idea.
 
@nightcracker Not in a healthy well-written compiler, no. Have you heard of an AST?
 
@jalf Careful there; he might work for Microsoft.
4
 
Xeo
9:18 AM
@Ven you can declare a class template, and also assign default arguments at that point. and then you can define the class template
 
whatever
I'm out
 
Ven
@Xeo yeah, s/declare (2nd one)/define/
 
Xeo
you can also assign default arguments at the point of definition
but it's either at declaration or definition
 
@nightcracker Most compiler optimizations are completely architecture-agnostic. It's a fairly important characteristic of them
 
Xeo
Fuck enums in C++ :|
 
Ven
9:19 AM
@Xeo class enums ?
 
Xeo
can haz deriving Enum plx?
 
user1804599
Use Java.
 
Ven
@Xeo I answered.
 
Xeo
@Ven The last version does actually work
6 mins ago, by Xeo
but it's either at declaration or definition
(as soon as you fix it to be actual C++)
 
Ven
@Xeo Coliru refuses
 
9:25 AM
@cHao: Yes, of course, but that is not the comparison we were talking about. The comparison we were talking about is not "minor edits" vs "fixing everything" (there, the preferred option is obvious); the comparison we were talking about is "minor edits" vs "nothing", and I fail to understand how you could honestly believe that "nothing" is better than "minor edits" when the "minor edits" correct issues that are widely acknowledged as undesirable on SO. — Lightness Races in Orbit 3 mins ago
 
Ven
@Xeo ohwhoops
 
Ven
@Xeo yea
 
Chat still sucking in Chrome dev :(
 
Xeo
You can even do fun stuff like this: coliru.stacked-crooked.com/a/93ba2215def4b724
 
Ven
9:27 AM
@Xeo funny enough.
 
Xeo
Your answer is still not fixed wrt to the code
 
Ven
@Xeo Now that's a comprehensive answer :P
 
@Xeo Ugh.
 
Xeo
@Griwes Cool, innit?
 
Ven
@Xeo Alright - I think I've got it all.
 
9:30 AM
@Xeo "fucked up" is what I'd use.
 
Xeo
Now the code in your answer and in the snippets doesn't match :D
(class A vs struct X)
 
Ven
@Xeo Yeah, to have struct/class consistency. Doesn't really matter.
 
Ven
@rightfold, the rightful nazi.
 
user1804599
Fuck spaces before colons.
 
Ven
9:32 AM
@rightfold I'm french. Simple habit.
@Xeo There's a special place in hell for people like you :P
 
@Xeo Innit.
 
user1804599
It so horribly ugly.
 
Ven
@rightfold That's how french is.
 
user1804599
French sucks.
 
Ven
@Xeo Added ;D
 
Xeo
9:34 AM
Ehehehehe
 
Why doesn't C have default parameters?
 
Ven
@Rapptz because they're bad.
 
Xeo
*arguments
 
user1804599
It would complicate things.
 
user1804599
Such as function pointers.
 
Xeo
9:36 AM
No?
 
no?
 
Ven
how so ?
 
user1804599
So when you create a function pointer, you want the default argument to disappear or what?
 
Ven
you mean, store the same function with default or not ?
 
@rightfold How do you think it works in C++?
 
Xeo
9:38 AM
@rightfold That's what happens. A default argument is not part of the type
 
user1804599
I have no idea, but it's probably complicated.
 
Xeo
No, it simply drops default arguments
 
Ven
@rightfold it's probably C++
 
user1804599
Meh. I never liked default arguments anyway.
 
Xeo
The type of the function doesn't change
and function pointers are based on the function type
LAKGHAHGJ
I need a way to iterate over an enum now.
 
9:39 AM
@Xeo epilepsy attack?
 
Xeo
Maybe I should just add Robot's enum-ops to our project
 
super duper complicated
 
user1804599
I have never needed default arguments.
 
user1804599
Don't know what people use them for.
 
to provide a default argument
 
9:40 AM
Cheap overloads.
 
:v
 
Sheep overlords
 
user1804599
@Rapptz No shit.
 
cheap overlord
 
too late
 
9:41 AM
:/
cheat overlord?
 
Ven
@sehe sleep overload
 
hmm i should probably confirm the interview
 
user1804599
I just create a new function with a different name when I want something like that.
 
functions are just lambdas in Lua :3
that really simplifies the AST for me
 
Lambdas are just letters in Unicode.
 
Xeo
9:43 AM
Ergo: Functions are just letters in Lunicoda.
 
In general I am glad that I am actually writing a compilerlanguagesomething thingy for a language that's actually decently designed, not Wide or Lasagnascript
You can feel it not only when you use it, but also when you implement it
 
Ven
good for you, buddy.
 
I wonder if that might work in reverse - if your language is impossibly hard to implement, maybe your design isn't that good somewhere?
 
Oh god you implementing languages too?
 
Ven
@BartekBanachewicz funny coming from somebody doing C++
 
9:44 AM
Lua is just a wrapper around C plus hash tables.
4
 
@R.MartinhoFernandes yeah, I somehow ended up doing that
@Ven Do I look like somebody doing C++? That's insulting.
 
Xeo
@BartekBanachewicz Oi
 
@Rapptz Mhm!
 
Ven
@BartekBanachewicz you do LOOK like somebody doing it, yes
 
clang it
 
9:45 AM
does anyone here have a JSON file I can parse to see if my parser is sane
 
already in the test suite :v
 
Ven
@BartekBanachewicz and your SO history seems to say "indeed"
 
same with that
 
Ven
9:46 AM
@Rapptz I haz big JSONs
 
@Ven that's a lie! Don't believe everything you read on the internet!
 
Xeo
malformed JSONs already tested?
 
gimme one
 
@Rapptz 42
 
Ven
@BartekBanachewicz oh okay
 
9:46 AM
@Xeo yup
 
Ven
@BartekBanachewicz is 10k lines okay
 
Xeo
unbalanced braces/quotes?
 
> Uncaught OCDException
 
@rightfold neat
 
9:47 AM
Anyway C++ is just a wrapper around C plus templates
 
Ven
@BartekBanachewicz you must mean plus classes.
 
plus everything else lol
 
no, plus plus classes
@Rapptz no, really? :P
 
@Xeo apparently I don't
 
plus RAII, too
and exceptions
(hi)
 
9:48 AM
hi
 
hi mate
anyway I should be off for the exam already :S
 
language design war going on?
 
Ven
@Rapptz if you parser handles that, you're fine.
 
9:50 AM
^ this
 
@LightnessRacesinOrbit is that a joke?
 
@Rapptz No; why do you say that?
 
it's incredibly condescending
 
@Rapptz How so? It's an accurate and to-the-point observation about human nature, written for free to answer somebody's question on the topic.
 
@Ven It is missing non-integral numbers, negative numbers, and the full array of string escapes.
 
Ven
9:52 AM
@R.MartinhoFernandes Well, prolly other files in there contain some of that crap
 
@Rapptz: He's not saying "you're a lazy fuck and you'll never be able to work so just stfu and give up" ;)
 
@R.MartinhoFernandes "useAnimationId": -1,
 
@Rapptz: He's saying "if you don't feel up to working this morning, instead of trying to force it, go do something else and relax until you are in the mood."
I used to take this approach with exam revision; get pissed the night before unless I really want to revise
 
@Rapptz Oh, well, it has negative numbers :) . doesn't grep though.
 
Xeo
Wait a second, Robot's enum ops are only for flag-type enums
meh
 
9:53 AM
What else would you need them for?
 
I'm adding more failure tests now
 
Xeo
What happened to the arithmetic ones?
 
It's silly.
 
Xeo
:|
 
So @Nokia paid a multi-million-Euro ransom to someone who stole a signing key. In cash. At an amusement park. Wow. http://m.mtv.fi/uutiset/rikos/artikkeli/nokia-paid-millions-of-euros-in-ransom/3448918
WTH
 
9:53 AM
But you can just use the macros to generate them anyway.
 
I'm loving the alternative headline to that
> Alternative headline: @nokia hid the loss of their key and compromised every end user that continued to trust it
 
@sehe How dumb is that.
 
This is quite entertaining
 
@R.MartinhoFernandes I don't even? I hope it's a hoax
 
> Had the key been leaked Nokia would not have been able to ensure that the phones accept only applications approved by the company.
HELLO!
 
user1804599
9:55 AM
Man.
 
The key being leaked was exactly what happened.
How fucking dumb.
 
Xeo
@R.MartinhoFernandes Yeah. Guess I'll just cast it, though. Meh
Using enums for array bounds / indexing sucks
I need something between unscoped and scoped enums
 
1
A: How to do something like "is_atomically_assignable"?

R. Martinho Fernandes"atomically assignable" is not sufficient condition for using a type to implement a lock-free data structure, so this idea is going down to the wrong path from the start. Using std::atomic is the only way in C++ to have both atomic assignments and the ordering guarantees necessary to implement a...

Should I have just said "stop implementing your lock-free data structure now and go learn about lock-free data structures first"?
 
@LightnessRacesinOrbit I'd rather go for the "just define your needs, think of a good interface to hide the implementation of those needs, spend some time tinkering with a trusted library implementation (possibly several) and amend your interface so it convenes all parties involved. Call it a day (implement your interface and use it)
@R.MartinhoFernandes that'd have been a comment, though. You can have both
Good thing they were able to recover it though :)
Such a close call....
:(:(:(:(
 
he looks like he wants to implement std::atomic..
 
user1804599
10:02 AM
let f = async(function*() {
  let response = yield ajax(new Request('GET', '/'));
  console.log(response);
});
 
user1804599
Woohoo.
 
Many thanks, looks good! — Ben J 1 hour ago
I think it will be time to bring out how-does-accepting-an-answer-work sooner rather than later
@rightfold interesting. What did you do for it?
> should thus stay away also from R-value references
I didn't know we had R interop in C++
 
In boo you can implement that functionality from user code.
 
user1804599
Even exceptions work!
 
10:08 AM
Zoidlang v342?
Always annoying to reinvent packet-oriented TCP.
 
apparently a JSON of [ passes. Wonder how I let that one slip :v
 
@R.MartinhoFernandes What is that? Sounds like UDP with ACK?
@Rapptz woot
 
@sehe Just slicing the TCP stream at well-defined boundaries.
In this case, JSON object boundaries.
 
user1804599
@R.MartinhoFernandes ECMAScript 6, noob.
 
10:28 AM
arghargha supposed to send my CV out this morning; just opened it and it ... needs work
fuck
I don't have time for this
 
Are you the puppy?
 
user1804599
Then don't do it.
 
Why do people still use C++ when it is outdated? Like aren't PHP and other languages better?
12
 
crickets
 
Xeo
I'll bite. The last update was 2011, the next update is this year. How do you define "outdated"?
 
10:33 AM
@Phantom C++ outdated? lol
 
I can't believe you took bait Xeo.
:(
 
Xeo
vOv
Nothing better to do right now
 
user1804599
@Phantom PHP and C++ are used for completely different things.
 
The guy is probably not even going to reply.
 
Xeo
prolly, yeah
 
user1804599
10:36 AM
PHP is almost exclusively used for web applications, whereas almost nobody uses C++ for web applications.
 
I do and it was the best decision I ever made
people should do it more
 
Xeo
You're also a weirdo, so yeah.
 
what web frameworks are there for C++ anyway?
 
I know Wt is one but it sucks
 
user1804599
10:37 AM
@LightnessRacesinOrbit Unclear what he's asking.
 
omg i need a web framework yo cos im writing a website lol cant do it otherwise yeah
 
user1804599
All I need is a HTTP abstraction library, because fuck implementing HTTP.
 
@LightnessRacesinOrbit really? I know you're funposting but you don't use anything?
 
Okay..but what about Java? Isn't Java better?
 
@rightfold CGI.
 
10:39 AM
@Phantom depends. What makes it better, do you think?
 
Xeo
If all you want is to troll, go elsewhere. You've entered a troll lair.
 
user1804599
@Phantom Java makes it more difficult to write decent abstractions than C++ does.
 
user1804599
@LightnessRacesinOrbit Well, FastCGI.
 
Because I want to start learning C++ but people suggested that I should consider java
 
user1804599
C++ is fun to learn.
 
10:41 AM
I did have to write a thin Cookies/Sessions impl, but it's easy. Okay, and add in a MIME parsing library.
 
what about database stuff?
 
user1804599
You don't need a web framework for interfacing with databases.
 
@Phantom Both languages are in use today. Both are relevant. Which one is "better" depends on what you're doing
 
user1804599
Web and database are completely orthogonal.
 
I know, I'm just curious.
IIRC POCO does some database stuff
 
user1804599
10:42 AM
Maybe he doesn't even have a database.
 
true
 
@Rapptz MySQL++ yo! That has basically nothing to do with web.
Ah, as rightfold already said
 
user1804599
Beh MySQL.
 
I'm mentally lagging a bit
 
We're all a little slow sometimes.
 
10:45 AM
Urghh.. I'm firmly in the 'slow' camp this morning.
 
@LightnessRacesinOrbit being an alcoholic lately?
 
@chmod711telkitty "lately"
abandoning Chrome dev; chat unusable
guess I'll have to live without these amazing StackApps to which I've become so unaccustomed
fucktards
 
It's becoming difficult to get a night off these days. Monday was the day before Anne's birthday, but Anne had a darts match last night, so we had our 'birthday meal out' on Monday, where I had to drink wine. Anne wanted to go back to the club after, so I had to drink beer. Last night was Anne's actual birthday and the darts match, so I had to drink beer. Tonight there is committee meeting at club, where there is a free beer, followed by beer. Thursday is England match against Uruguay, so big screen at club, where I shall have to drink beer. Friday and Saturday there is beer festival
 
> had to drink wine
 
Xeo
@MartinJames You might want to scale down on the beer. Just maybe.
 
10:54 AM
@LightnessRacesinOrbit I'm not eating an expensive restaurant meal without wine!
 
Do you prefer FileName or Filename (both are correct).
 
user1804599
Filename
 
Xeo
^
 
filename
lowercase f
 
user1804599
It looks better in longer names.
 
10:55 AM
I've actually cut down a little lately. Down to three or four nights out a week. Usually get through four or five pints followed by four or five DVCs
+ the occasional round of Sourz at the weekend
 
user1804599
BlablaBoobFilename
 
nom nom
@StackedCrooked FileName is FUgly
 
Xeo
I didn't drink anything alcoholic since the Unconference. I should get myself some Mojito.
 
@Xeo I'm trying - it's just that this week all those events are happening. As if last week at unconference was not enough. I really need some consecutive dry-out days.
 
Xeo
10:57 AM
@LightnessRacesinOrbit "un-" vocabulary is restricted to Unconference attendees.
 
My worst lately is 4 days in a row - I blame camping on a long weekend. Too damn cold to fall asleep in subzero degrees without a few gulps of whiskey beforehand
 
Xeo
Your own fault for not showing up.
 
@chmod711telkitty parents kicked you out of the house for trolling again?
 

« first day (1341 days earlier)      last day (3623 days later) »