« first day (940 days earlier)      last day (4010 days later) » 

4:00 AM
..... Hm.
Wait a second
Maybe I can chain it like that.
 
no, you can't
you have to use a nested function call or an explicit separator to disambiguate.
 
But
But I have a dream. ;~;
 
but tough
there is no algorithm that can determine what the user meant in the general case even if you had infinite time, memory, and information, and not the serious constraints of templates in C++
 
Well, if the problem is a disambiguator,
then I could use an argument-based disambiguator
much like std::allocator_arg_t
 
> explicit separator
 
4:05 AM
make_chain ( arg1, arg2, begin_functor_t{}, .... );
 
operator is better
 
Well, if I write this,
I can build the operators on top of it.
Does anyone already have something like that?
boost ?
Or maybe wheels ?
 
Boost.Range
 
It uses free-function binary operators, right?
 
yes
operator|
 
4:07 AM
I was gonna say operator>, but
That one's already used for comparison
though it would be nice
tuple("hello", "world") > Combine > PrintInteger
^ Would be a nice "this goes into this goes into this..."
Even better would be =>
But that's not an operator =[
 
>>?
 
Ugh
Stream operators
Those leave a bad taste in my mouth. =[
 
You are such a baby.
 
It doesn't make sense, though.
 
it's existing practice
 
4:11 AM
=> implies "into this" or <= "into that"
it looks like an arrow
other languages even have -> and <- for left-or-right expression assignment
Even something like
:= or =:
Where you can explicitly show the order of preference
:= := := (all left associative)
=: =: =: (going to the left, right-associative)
 
k.
Work with what you have
 
Well, top candidate is |
Because it has so little use in everything else.
 
I'm sure you use bitshifting a lot.
 
I can only imagine how much of a cockfest I'd be putting my vagina into if I used << and >>
All the free-function overloads that would suddenly be candiates for my functor chaining.
A waste.
I don't think any other operators would be a good candidate
there's &, which also makes sense
tuple("Hi", "There") & Combine & PrintOut
There's also ^
 
 
4:20 AM
a & b
a | b
a ^ b
Of all these, which would you chain your functions with ?
Also, can you have 2 variadic template packs in your declarations?
 
> error: 'exception' is not a direct base of 'execution_double_error', can not inherit constructors
That's a limitation of Clang, right?
 
dunno... the inheriting constructor wording is extremely restrictive in what you can and can't do
 
That's a questionable assertion.
 
well, it's only my vague memory of reading it
but I would not be surprised to discover that in fact you can only inherit constructors from a direct base
 
You should be. Inheriting constructors don't do much.
 
4:29 AM
# it's like C++11
mount --make-shared /mnt
mount --bind /mnt /tmp
 
Lol
 
> In a using-declaration used as a member-declaration, the nested-name-specifier shall name a base class of the class being defined. If such a using-declaration names a constructor, the nested name-specifier shall name a direct base class of the class being defined; otherwise it introduces the set of declarations found by member name lookup (10.2, 3.4.3.1).
 
such an assymetric Lol :P
 
loL
 
LoloL
 
4:31 AM
loauL
 
> The type denoted by a base-type-specifier shall be a class type that is not an incompletely defined class (Clause 9); this class is called a direct base class for the class being defined.
 
it's like we're sabotaging a very serious discussion with our lols
 
I see. Had a lapse of terminology here; because I'm dealing with an exception hierarchy I thought the 'direct base class' term was somehow linked to virtual bases.
Fixed! Thanks Clang.
Lawl, multiple copy constructors disable generation of the copy constructor in a child class. So much for that.
@R.MartinhoFernandes ^ screw that trick
 
There's no variadic print function in the std::, is there?
 
no.
 
4:43 AM
That's odd, I can't locate those alleged multiple copy constructors.
 
@DeadMG (and maybe LucDanton if you have some time? <3) How would I do something like what Cleave is trying to do here?
It seems to be assuming the variadic pack Tn should be empty in this case.
And demanding the first argument 1 should be a disambiguator_t before shoving everything else into the variadic pack Tx.
 
Nice errors.
 
Also, uh
how come when I print std::endl twice coliru doesn't output blank white lines? @StackedCrooked
 
Ah. Didn't notice that yet.
That will probably be a bug that was introduced with the clickable error messages.
 
Ooh.
Okay.
 
4:58 AM
do you even know if a variadic template function can take two parameter packs separated that way?
 
No.
I'm figuring it out now. :D
 
Man... soo much stuff to install on my fileserver before it can completely take over as my main machine.
 
5:44 AM
@ThePhD: It appears that the compilers do no backtracking. The first pack eats all the arguments.
 
@wilx It appears so...
It looks like variadic template arguments are greedy.
@wilx And it's not the first pack, actually.
It's the last one.
Tn is first, Tx is last.
Tx... gets all the arguments.
So argument greediness is right-associative with variadic templates.
 
Xeo
Variadic packs other than at the end of the parameter list are a non-deducible context.
 
Yeah, so it seems. =/
 
Xeo
Not only "seems", that's how it is.
 
Is there any way to "build" a variadic pack as you go along?
 
Xeo
5:52 AM
std::tuple
Or, std::forward_as_tuple rather
 
I meant in recursive function calls
Like, uh
 
@Xeo Function parameter pack?
 
Xeo
@LucDanton Ya
 
E.g. indices<I...> involves a variadic pack that is deducible.
 
Xeo
@LucDanton Ya, but I mean as an actual parameter (pack).
 
5:54 AM
If I have template <typename ...Tn> Cleave ( Tn&&... argn ) {}, and I had another one that only looked at one T at a time, could I slowly build up a std::tuple until I hit a disambiguator_t and then pass that down to another function with takes a tuple?
 
It's the Standard terminology: "A parameter pack is either a template parameter pack or a function parameter pack."
 
Xeo
Brain's still booting up.
 
@Xeo Borrow Robot's bootstrapper, maybe it'll help. :D
@Xeo What I'm trying to do is collect all the types up until the disambiguator_t.
So I basically end up with a std::tuple<int, int, int>
But I'm having a really hard time doing it >_<
I think I'm going to resort to a std::vector<any> and cheat like a scrub.
 
Xeo
Hah... Coliru shows no output :|
 
... There's no output
What's happening? o.0
 
Xeo
6:08 AM
@Stacked: Are you live-editing Coliru again? :<
ideone.com/T5WEE2 will have to do for now.
 
Hm, no.
 
template <typename ...Tn>
void Print ( Tn&&... argn ) {
    using swallow = int[];
    (void)swallow{ (std::cout << argn << " ", 0)... };
}
What is this magic?
 
lol
 
I'm interested too lol
 
6:10 AM
sorcery
 
Xeo
Pack expansion with enforced left-to-right evaluation.
 
hey @Xeo, guess what--i'm joining the llvm team
at apple
 
congrats
 
cool, eh?
feel free to complain to me about performance issues
 
Xeo
@StephenLin I was going to congratulate you - until the second message came. :P
 
6:11 AM
haha
fine fine
 
Xeo
@StephenLin Oh, expect @DeadMG to bombard you.
 
i won't be working on the front end though
i feel like deadmg is more of a front-end guy
i could be wrong
 
define front-end?
 
language to IR
rather than IR to assembly
 
@Xeo Well, whatever the shit it is, I don't think it'll work on VS2012 >_>
 
6:12 AM
anyway, for my purposes, the more people complaining about performance, the better :D
 
then yes, that is what I'm working with right now
 
It is nice though, I'll try to make it work with VS2012. <3
 
otherwise, i have to do more work to justify my suggested optimizations in terms of compilation time budget
for one thing, llvm doesn't do compile-time linear constraint solving as well as gcc (i.e. it doesn't really do it at all)
 
did you see ccarruth's slide about mis-inlining?
 
6:15 AM
@Xeo How come it can properly split it with that U&& in there and not the exact parameter?
 
(was that directed at me?)
 
yes
 
ok, well, i know the name from the llvm lists but i haven't really been active in the community for more than a couple of months so i don't know what you're referring to
 
Xeo
@ThePhD U&& can take everything, disambiguator_t can't - and the first pack is always going to be empty if you don't explicitly specify template arguments with cleave<args, here, ...>(...)
1>src\main.cpp(30): error C2783: 'void cleave(Ts &&...,U &&,Vs &&...)' : could not deduce template argument for 'Ts'
1>          src\main.cpp(25) : see declaration of 'cleave'
1>src\main.cpp(30): error C2783: 'void cleave(Ts &&...,const disambiguator_t &,Vs &&...)' : could not deduce template argument for 'Ts'
1>          src\main.cpp(16) : see declaration of 'cleave'
MSVmeh
It shouldn't even try to deduce it :|
I wonder if that's fixed
 
@DeadMG is the slide about a clang/llvm bug?
 
6:18 AM
@StephenLin Yes.
 
@DeadMG link? is it fixed?
 
@StephenLin Dunno and check it yourself, it's from the slides from the LLVM dev conference just recently
 
ok
the euro one?
 
yes
 
okay
hmm, there's video but no slides online afaict
too lazy to look into it
maybe later if someone else mentions it again and there's nothing more urgent
@deadmg, by the way, you might like this language idea i floated when i interviewed
actually, one idea
"exact" types
it's like a cv-qualification
that indicates that a pointer has as its most-derived type of the static type of the variable
also, the implicit conversion goes the opposite direction as const...you can take it off implicitly but not add it
basically, it's a non-polymorphic pointer to a polymorphic type
 
6:23 AM
so... just a pointer to a type which is marked with sealed, final, or your favourite inheritance-banning marker
 
yeah, but it's a property of the reference
not the original type
so the original type need not be final
so you can dynamically check the type of the object
 
yes but what actual advantage is this going to give me.
 
devirtualization
right now, if you statically know the type of an object
 
I have little need for dynamic typing but when I do use it, I actually intend to use a virtual call.
 
it doesn't really help much
 
6:24 AM
if I know the real most derived type of an object, I can simply cast it.
 
but it won't devirtualize unless it's a type or virtual method with final
or you explicitly static dispatch on it
 
explicit static dispatch is fine.
 
Ell
What is devirtualisation?
 
but that only devirtualizes the first level
you can't template over it
 
you're taking a ridiculously niche case for which an existing solution is fine and applying a complex core language feature on top.
 
6:26 AM
well, i agree with that
 
the cost:benefit of this is not going to work out
I don't care enough about the cost of a couple of vcalls extra that the user can eliminate with a cast anyway
 
well, before final existed, i would disagree
well, no, you can't eliminate it without casts unless the method is also final
you can eliminate one level of virtuals
at the specific function
one at a time
but the informatoin doesn't propagate
that's what this gives you
 
Ell
The overhead Of virtual calls isn't very much
 
but, if you design your hierachy so that everything is either abstract or final
 
right
 
6:27 AM
then you're right, this is pointless
 
@Ell depends
 
but if I have a problem with unnecessary virtual calls then I will simply template instead of using run-time inheritance.
 
@Eli, indirect branches kill pipelines
@DeadMG what if you want to interop with another language
@DeadMG and expose compile-time inheritance dynamically to another language that doesn't understand tempates?
that's the use case
 
your use case does not exist
you can't expose a template as a run-time interface.
 
you can
if you had language features for it
 
6:29 AM
no.
you are talking about taking information which exists only at compile-time, and trying to psychically determine what it is going to need to be at run-time.
 
17
Q: C++: Class specialization a valid transformation for a conforming compiler?

Stephen LinHopefully this isn't too specialized of a question for StackOverflow: if it is and could be migrated elsewhere let me know... Many moons ago, I wrote a undergraduate thesis proposing various devirtualization techniques for C++ and related languages, generally based on the idea of precompiled spe...

@DeadMG, that link gives one method of exposing compile-time specializations at run-time
you basically switch on a type at runtime to switch another type to a specialized version
 
that's not even remotely equivalent.
 
that way, you have the benefits of compile-time specialization but allow the specialization to be accessed through run-time polymorphism
 
where is the storage going to be for the derived members?
and secondly
 
well, in this case, they're specializations of method implementations, not data
but you could adjust it
 
6:31 AM
those run-time function's signatures cannot contain "template" parameters.
 
you'd have to allocate slack space in the unoptimized object
well, you can mix and match templates and pseudo templates
 
so if I have a template C, then in fact you can only generate a run-time interface equivalent for a template that takes basically no advantage of being a template whatsoever.
 
it does have an advantage
it's specialized after the first level of indirection
 
it has the advantage of being worthless
 
you have to indirectly access the template
or psuedo-template
 
6:33 AM
firstly
how many decades has it been since people had a real performance problem calling virtual functions
 
but after that, all calls are direct
 
and secondly
 
the general problem is an issue, i have problems with cython code that is unspecialized
 
the extreme limitations of your system render it unusable in virtually every case
 
it's the same basic concept
well, these are only specific examples of a more general mechanism to access compile-time specializations at run-time
the idea is to make it ABI compatible anyway
so you don't have to use it if you don't want to
 
6:35 AM
which is never going to work because virtually every useful template has as part of the signature the template parameter.
 
and therefore those templates are not accessible to any other language unless you swig a type parameter-specific wrapper it or something
 
meh
such are the limits of inter-language interoperation
I would know, I've been doing a lot of it recently
 
anyway, you're wrong that it's useless...i could take some cython code that's performance critical and reduce the number of lines by an order of magnitude with things like this
basically i instantiate lots and lots of templates specific to specific parameters that i have to check at runtime
 
the number of lines is not indicative of the performance saved
 
it's not
that's not the point....it's optimal as-is but ugly
 
6:37 AM
and secondly, that does not imply that there are not other simpler techniques which could improve the performance of that code.
 
you shouldn't have to instantiate the same template over and over again manually
 
@StephenLin The incredible nicheness of the use case you are describing leads me to not care at all.
 
yeah, it's a niche
performance critical numerical object-oriented code
it happens to be the niche i work in
 
wtf is numerical object oriented code
 
then why are you even using dynamic dispatch in the first case
 
6:38 AM
i started programming to implement neural simulations
 
The only one I can think of is Eigen
 
@StephenLin Well, if you are designing a language, you can't introduce a new feature for every single niche in existence ever.
 
so it's a fork of the language that happens to be binary-compatible, sure
that's what i always intended this stuff as
 
if you are implementing a new language
 
i agree C++ is too big to begin with
 
6:39 AM
you are going to want to do a lot more than "static_cast but ridiculously over-specialized"
 
but right now, there's no ideal language if you want lots of dynamic types (because the problem domain is inherently object-oriented) and lots of small numerical functions
well, sure
i never said this was the only thing to do
i mean this is something that could be done in an ABI-compatible way
ABI-compatibility is the key
 
no
fuck the ABI
 
well, it's important if you want to actually, you know, link with existing code, you know :D
i guess if you don't want to do that, then sure
 
that's quite true, but the C ABI is more than sufficient for most languages
 
that's like saying qsort is sufficient, so why have std::sort?
 
6:42 AM
there isn't even a C++ ABI you can follow and be done with, you have to dick around with a thousand different ABIs
and Clang doesn't even offer good ABI abstraction support
 
same problem really
there's like 3 big ones really
 
So
 
generic itanium, ARM, MS
 
After fully reading and understanding what Xeo did
I do believe I've creamed my pants.
 
you could hack most of what i want to do into all three
 
6:43 AM
but it's such a niche that I have absolutely no incentive to do that
 
you might not, i do though
i work on pandas in addition to llvm
 
then why did you bring it up
what a waste of my time
 
basically there's lots and lots of autogenerated cython
to handle exactly this sort of thing manually
well, i'm not psychic :D
how am i supposed to know you don't care about numerical performance in the presence of dynamic types?
 
@Darkyen I'm glad you found it :)
 
it's fair if you don't, but i do and plenty of other non-niche people do
 
6:46 AM
@Darkyen Welcome to the land of C-style API. That's mostly why harldy a soul is usually very enthusiastic about C in this room
 
@EtiennedeMartel i cant possibly imagine this being good. The scene when whe bounces off the guy totally sold what kind of crap it will be. :(
 
@DeadMG anyway, sorry to offend you :) but i wonder if you'll ever come across a situation where you need to obtain one of 20 different specializations of a function/class at runtime and then decide it might be nice if you had language support for it :D
if you never do, more power to you
 
@ScottW you, disruptive lurker! :)
 
i happen to need to do that quite often
i was a quant in finance previously (before pandas, after the neural simulation stuff)
and this happened all the time
 
@StephenLin I doubt it
 
6:52 AM
@BartekBanachewicz do you write numerical code?
you basically can't mix numerical code and runtime polymorphism, as things stand
unless you don't care about performance
i had this exact same problem when implementing CDO simulations as when simulating neurons
basically the solution right now is to drop the type-based runtime polymorphism and use a bunch of case statements
or use a functional language with pattern matching
neither is ideal if you want to interface with other languages or existing C++ libraries
if you don't come across problems like this, that's fine, but it doesn't mean it's a niche
or at least, it doesn't mean it's a niche that no one cares about
 
@StephenLin Fun Fact: Most of us here have no experience with performance critical programming. :)
 
Hey, I do. D:
 

« first day (940 days earlier)      last day (4010 days later) »