« first day (481 days earlier)      last day (4475 days later) » 

Xeo
8:00 PM
> Apparently it already works for C/ObjC in clang though.
@CatPlusPlus Exactly what I had in mind right now. :/
 
@MooingDuck Er, you can have a file with no implementations.
 
@RMartinhoFernandes Not if the interfaces are generated from the cpp.
 
Right now, you must parse an hpp file as well.
 
@RMartinhoFernandes so you have to use the hpp, then what do we gain? Why modules?
@RMartinhoFernandes wait, I just realized I was thinking of this all wrong
 
Clean build will always be slow.
 
8:01 PM
Good.
 
It doesn't matter that it has to resolve dependencies first.
 
@RMartinhoFernandes I'm dumb. This isn't a replacement for .obj files, it's a replacement for dlls. Duh. I got it.
 
It's not a replacement for DLLs.
 
Wait, now I'm confused.
 
Well, unless it comes with predefined ABI and dynamic library loader, which I can't say would be bad idea.
 
8:02 PM
No, it doesn't.
 
Would certainly make me happy.
 
It's not "DLL modules".
It's just "kill headers modules".
 
@RMartinhoFernandes then I'm completely missing the point of modules. They seem to add nothing, but require much slower compilation for clean builds. Unless you have all the same headers you always had.
 
Xeo
@MooingDuck Question: How often do you need to parse <vector> if you include it in 3 .cpp files?
 
export MyModule;
public:
    void f(); // no implementation
This is all you need to parse.
 
8:04 PM
Automatic interface exporting. Less dependencies when interface doesn't change.
 
It's to kill the fucking #include directive.
 
#include is still good for macros.
 
Xeo
@EtiennedeMartel Not completely, macros don't work well with modules (obviously)
 
But the rest shouldn't be compiled over and over again.
 
@MooingDuck It's basically PCH modules.
 
Xeo
8:05 PM
5
A: C++1y Modules and the C++ ABI

Nicol BolasPre-compiled headers (PCH) are special files that certain compilers can generate for a .cpp file. What they are is exactly that: pre-compiled source code. They are source code that has been fed through the compiler and built into a compiler-dependent format. PCHs are commonly used to speed up co...

 
@Xeo The proposal I was looking at doesn't seem to have thought through template classes thoroughly, but I guess it still has that point
 
Xeo
Here's an awesome answer that explains what modules are
 
@Xeo Vandevoorde's modules.
 
Xeo
Yeah
But I don't really get what other modules you could have
 
But then, no one pining for "DLL modules" ever made a proposal.
 
8:06 PM
@RMartinhoFernandes that's the paper I was reading
 
Xeo
(for compilation, not DLL stuff)
 
It's less hassle to just export C-ish interface.
 
Xeo
@CatPlusPlus That's the problem with Doug Gregor's "simple" modules proposal as I see it, since in C it's simple
 
@Xeo Oh, you found docs?
 
Xeo
@RMartinhoFernandes No, but from hearing that it's implemented for C... :P
 
8:08 PM
@RMartinhoFernandes For a clean build, it has to parse all of MyModule.cpp before it can parse any other file that imports MyModule.mpp. It would increase times for rebuilds though.
 
@Xeo Well, it's being proposed for C++ and Bjarne likes it.
 
How often do you rebuild vs doing incremental builds?
In the long run, it's faster.
 
@RMartinhoFernandes Some of my confusion comes from this, why don't compilers automatically PCH?
 
Xeo
@MooingDuck Read the answer I linked
 
Because it loves to break horribly.
Well, MSVS defaults to PCH in new projects.
 
Xeo
8:10 PM
Yeah, but PCHs suck. You can only have one, and it needs to be included before everything else
 
@CatPlusPlus wut? just create "empty project"
 
@Xeo And pain. You're missing the pain. I'm pretty sure there's pain involved somewhere.
 
@Abyx No shit, Sherlock.
 
@Xeo I read the answer, but it doesn't have a reason besides "That's the rule." Why can't compilers automatically PCH every header?
 
Right now compilers have to stop compilation at some point to dump the PCH.
 
8:11 PM
@Xeo WUT? one? you can setup different PCH for every .cpp file
 
@Abyx one per TU
 
Hence why you need to include it before anything else.
 
@CatPlusPlus I don't understand that point
 
Compiler remembers where the PCH is included, preprocesses, compiles up to that point, and then dumps internal structures as the PCH.
 
A PCH is basically a compiler state snapshot.
 
8:13 PM
MSVC supports #pragma hdrstop, too, AFAIR.
 
You can't merge them (not easily at least).
 
And really volatile snapshot at that.
MSVC simply dumps the raw virtual memory.
 
Xeo
Damn, 140 character limit in Twitter sucks.
 
@Xeo twitter sucks in general
2
 
@CatPlusPlus I don't see why it needs to dump them unless it's out of virtual space, in which case it has to dump something to the disk anyway, so no penalty.
 
8:14 PM
GCC probably does something similar, given how much it breaks with PaX enabled.
@MooingDuck Eh?
It needs to dump it, because it's *pre*compiled header.
Pay attention.
 
@CatPlusPlus you're right, I was thinking of something slightly different
 
Xeo
@MooingDuck Into the .cpp file, not on disk.
 
@CatPlusPlus I was actually wondering why compilers don't cache the parsed headers, which also avoids the PCH and module thing.
 
Xeo
@MooingDuck Macros.
 
You can't just cache parsed header, because headers don't really exist.
 
Xeo
8:16 PM
// 1.cpp
#define BLUB BLAH
#include "blub.h"
// 2.cpp
#define BLUB BLARGH
#include "blub.h"
 
You could cache for different sets of macros, that's not the point.
 
Xeo
@CatPlusPlus Right, #include is just ctrl-c, ctrl-v of the entire file
 
It's just hard to tell what to cache.
 
@CatPlusPlus I had been thinking it, but I just now realized that's a failure of an idea
@Xeo macros just ruin everything don't they?
 
Macros aren't the problem.
Headers create complex hierarchies of included files.
 
8:19 PM
@CatPlusPlus which are static, except for macros
 
If you have four headers in your app and they include some stuff from STL, what do you cache?
What #include "foo" yields, with STL stuff?
Or everything separately? But then how do you tell?
 
@CatPlusPlus presumably everything in foo, with a link to each compiled STL header it included.
 
Stdlib tends to include large amounts of weird internal files.
Special cases arise.
And more pain.
And if it were simple, it'd be done already.
 
@CatPlusPlus what special cases, seems straightforward sans macros
 
Xeo
// foo.h
#include <blub>
#include <blargh>
// foo.auto_pch
#pchref <blub>
#pchref <blargh>
Would be a dream if it were that easy. :P
 
8:21 PM
Headers include other headers, and the amount of included files increase exponentially.
I really can't wrap my head around how caching each header would work.
 
windows.h I'm looking at you.
 
@CatPlusPlus a list of classes/functions/globals in this header, and a list of other cached headers that were included. Obviously, macros ruin everything.
 
Modules are entities with some exported interface. That you can cache, because you know what to treat as a whole.
 
Xeo
@CatPlusPlus Cache everything sans the includes, cache each include, add reference to cached includes. Obviously!
@RMartinhoFernandes Please don't mention it...
 
@Xeo And somehow I doubt it'd be a significant improvement. :P
Current system is just simply and plainly broken.
 
Xeo
8:23 PM
You can't even include single Windows headers, because they might depend on that a special other head is included before it.
 
@CatPlusPlus it should be the same speed as modules, with no change to the language. Except for the macros
 
Xeo
"Modularity? What's that?"
 
It's not just about speed.
 
Modules give good encapsulation.
Privates are truly private.
 
Xeo
Finally, a "static" pimpl!
 
8:24 PM
And you can't do weird stuff like textually include one module into another. Module is a module.
 
@RMartinhoFernandes did they figure out private class members?
 
Xeo
(aka no need for dynamic alloc or size guesswork)
 
@MooingDuck All the module needs to export with a class type is two integers: size and alignment.
 
Xeo
@RMartinhoFernandes And a list of public/protected symbols
 
@RMartinhoFernandes I didn't see that in the spec, but it's good that they specified something like that
 
8:25 PM
I think I saw it there.
But maybe I just deduced it. Lemme check again.
 
@RMartinhoFernandes I'd assume they did. To do otherwise would be silly
 
I still want TH to replace preprocessor entirely.
 
@MooingDuck Ah, it's on page 16.
 
Xeo
Another great thing about modules is that you only load what is actually queried by the importing module
 
And no hell-grammar parsing involved.
 
Xeo
8:28 PM
That means doing import std; is awesome, in contrast to #include "includes_every_std_header.h"
 
Xeo
No need to manage fucking dependencies anymore with modules. Just import the whole slew, let the compiler load the symbol table, and go from there with what you actually query.
 
Also we could do implicit namespaces! import qualified foo.bar.baz > namespace foo { namespace bar { namespace baz { /* ... */ }}}
 
Xeo
@CatPlusPlus What qualified ?
 
Haskell stuff.
 
8:30 PM
I'm talking Haskell, but you get the gist.
 
Xeo
Actually, I don't :(
 
In C++ we'd probably want imports to be qualified by default.
 
good point
 
Xeo
@CatPlusPlus What exactly do you mean now?
 
8:32 PM
import std would import module std and put names into std namespace in the importing module.
 
Xeo
@CatPlusPlus Ah
 
Less boilerplate when writing modules.
 
Xeo
But modules and namespaces are intentionally orthogonal in that proposal
 
I'm just dreaming, I haven't read it.
 
In Haskell, import brings everything into scope.
 
Xeo
8:32 PM
@CatPlusPlus What about export std.vector; // partial module?
 
You have to write import qualified to required prefixing stuff with the module name.
 
Xeo
Ah, ok
 
Haskell has module re-exports, it works as if you'd import all names from that module and export them explicitly.
 
Xeo
non-issue in C++, though.
 
And there's hiding for when names collide, there's import A(x, y, z) to import only x, y, and z.
It's awesome.
 
8:34 PM
Haskell is awesome. And it doesn't use bullets to shoot you in the foot, but arrows instead!
2
 
Xeo
@CatPlusPlus And shoots you in the knee? /duck
 
Put that in a single message. I want to star it.
 
Well, in the brain.
 
stanford.edu/class/cs106b is a programming course that teaches students to use their custom Stanford Library including Set, Queue, Vector, Map, Stack, Thread, and others. Should I email the professor in protest?
 
Xeo
@MooingDuck Burn him in protest.
@MooingDuck But it's still "STL", huh? That name has something magic in it..
 
8:38 PM
@Xeo I see no reference to namespaces, but the API is entirely different.
Vector digits;
digits += 0, 1, 2, 3, 4, 5, 6, 7, 8, 9;
 
Xeo
@MooingDuck Hello Boost.Assign
 
"We're experiencing some technical difficulties... We’re sorry, but Yahoo! Mail can't load due to a temporary error. You can try back again shortly, or visit our help pages for ways to troubleshoot the issue." No thanks, rage is fading...
 
sbi
@Xeo Twitter's 140 character limit teaches you humility. :)
 
Xeo
@sbi No, it teaches me to send two tweets. :P
 
sbi
@CatPlusPlus A clean shot might be much less painful that an arrow.
 
8:40 PM
@MooingDuck Wait, just Vector, no element type?
 
sbi
@Xeo A common novice failure.
 
@Xeo Two tweets? Sacrilege.
 
@RMartinhoFernandes half their samples have Vector<ValueType>, half are Vector
 
@sbi Arrow is more awesome, though.
 
8:42 PM
@RMartinhoFernandes that doesn't happen often! Gratz!
 
sbi
Damn you twitter, I'm not even going to *try* to cram this super witty and insightful thought down into 140 characters!
@CatPlusPlus Did you notice the barbs?
@RMartinhoFernandes Tell me!
 
@sbi There's no class Bullet in C++, but there's class Arrow in Haskell.
 
sbi
@RMartinhoFernandes Oh well. So?
Once we're with @jalf, I might as well quote:
 
That's why he mentioned arrows.
 
sbi
Can't wait until I get older. I'd make an awesome grumpy old man
 
8:44 PM
Oooh, he's planning to replace you.
 
oh goody, now my phone is sending me spam in the notification bar.
time to uninstall groupon
 
Xeo
lol
 
sbi
@RMartinhoFernandes I'm not that old. Let's just say he's planning to complement me, Ok?
 
@sbi Or replacing you.
You don't have to die of old age.
Meatbags are very fragile.
 
sbi
@RMartinhoFernandes I'm not that old. Let's just say he's planning to complement me.
 
Xeo
8:46 PM
@sbi No, it's actually your intricate, evil plan to assimilate him.
@RMartinhoFernandes So are tin cans.
 
And glass... glasses.
 
I'm not made of tin (or any other metal). I explained before that I'm made of highly durable plastic.
 
Like a Mac product?
 
Xeo
Modules presentation no 3 by Lawrence Crowl, focused on pre-parsed headers. #wg21 #cpp
Hm. I got 0 rep today.
 
lol
Is that even possible? :P
 
Xeo
8:53 PM
Yeah
I was at -1 for a while because I downvoted someone
 
Yesterday I capped without doing anything. Today it's getting hard, and I'm trying.
 
Xeo
I also only wrote 2 answer today. Hmm..
> Doug says that implementing template support is on his todo list :)
Let's see if it's still as simple as before after that...
 
Friendly greetings! (I'm Torley Linden.)
 
It would be interesting to see a talk by Stepanov.
Ooh, found one.
 
0
Q: Get random element and remove it

StalsProblem: I need to get a random element for a container and also delete it from that container. Container does not need to be sorted. Vector can get me random element in O(1) but delete it only in O(N) List deletes element in O(1) but can only get random element in O(N) So I came up with an i...

 
9:06 PM
@Stals can't you just shuffled and then removed the first/last always depending on what the container is?
 
@Stals What's wrong with your idea?
You said it doesn't have to be sorted.
 
I'm not 100% convinced swap to back gives the distribution you'd expect
although it's probably as good as your RNG to begin with
 
Ell
9:23 PM
hi again guys
 
@RMartinhoFernandes Im just interested in other ways to do it
 
@Ell Hi :)
 
@Stals best options are either swap then pop, or use the vector's delete. It's probably not as slow as you fear.
@Stals protip: traversing to and then removing a random element from a vector is faster than a list, always.
 
9:40 PM
hmm, I was called an "idiot" on SO. That doesn't happen everyday.
 
are people warned/plink'd if they have a comment removed for being offensive?
 
Not that I know of.
 
@RMartinhoFernandes I'd misread the question at stackoverflow.com/questions/9218724/…, and when he pointed it out, I removed my comment and downvote, as context for his statement.
 
@MooingDuck i flagged it anyway
 
9:44 PM
@MooingDuck Can't see anything now.
 
A "bidimensional array", there's an interesting term.
 
.LoL
 
@MooingDuck What's wrong with that?
 
@RMartinhoFernandes technically nothing, it's just unusual.
 
Ell
dyu think c++ will ever make const char* literals std::string's?
 
9:48 PM
No need. std::string operator"" _s(char const* str, std::size_t) { return std::string(str); }
Now you can do "blah"_s and it is a std::string..
 
what I want is for std::integeral_constant to be implicitly converted to it's value_type. Makes faster math functions easy.
 
Ell
@RMartinhoFernandes are they the new user defined literals?
 
@Ell yes
 
Ell
i have always wanted those, but only "to be cool" and i never though c++ would get them
I always assumed it would be ruby or some dynamic language. not sure why.
 
9:50 PM
 
Ell
megusta mucho
 
Xeo
Okay robot, I'm no longer at +0. :(
 
ella es heeermossaaaa.... :D @Ell
 
@Xeo Not happy?
 
Ell
:D
 
9:54 PM
I could use four more boats.
 
Xeo
@RMartinhoFernandes Dunno, I just thought I could get by without upvotes
But I couldn't resist answering that question
 
@Ell sabes su nombre?
 
Xeo
@RMartinhoFernandes 5 for hard cap, though
 
Ell
@DzekTrek me llamo elliot. No puedo hablar espanol bien :S
 
oh, ok :)
lets talk in english then
 
sbi
9:57 PM
I can't believe we are discussing (void) as a parameter list :( #WG21
 
@Xeo That doesn't count for the badge.
 
Ell
yes :)
 
@sbi :( Wait, what?
 
Xeo
@sbi What?!
 
Where do you come from? @Ell
 
Ell
9:57 PM
@DzekTrek the uk :)
and you?
 
nice, UK rulez. :)
US :D
 
sbi
@RMartinho, @Xeo: I have no idea. I'm not there.
 
Ell
UK does rule! where abouts in the US?
 
across the ocean, as old englishmen would say.
Tampa, state of Florida
 
Ell
ahh, unfortunately I'm not an old englishman. I'm a shiny new one :D
 
sbi
9:59 PM
Realised, whilst reviewing Stephan T. Lavavej's presentation from #GoingNative, that every single slide title was from TvTropes. Kudos. #fb
 
Xeo
@sbi I just asked over Twitter
 
Ell
ooh florida, luxurious
 

« first day (481 days earlier)      last day (4475 days later) »