« first day (418 days earlier)      last day (4532 days later) » 

6:07 PM
Stupid router.
 
Is there any other kind?
 
It's prolly smarter than a switch at least.
 
Expensive router.
 
fuck
after all that, it doesn't work because the lexer doesn't treat comments properly ;p
 
Would this be an appropriate moment to use the word "fail"?
 
6:17 PM
sure
I had type /* some commented shit */ and the parser saw type * /
no wonder it decided that wasn't kosher
 
well, instead of type { it saw type * / {, which is obviously not a legal type
 
Oh the lexer discarded everything except the comment terminator?
 
yeah
 
Do comments nest?
 
6:19 PM
that's not the cause of the problem
 
I know.
I'm just curious if comments can nest.
Like, in general.
 
uh
no, I don't think so
once /* is found, */ is looked for as the terminator
 
Ah, like C then.
 
for now
 
Lazy! Boooo!
 
6:25 PM
lol
I'll worry about nested multi-line comments after I'm done considering how I'm going to specify dynamic module and implementing code generation, and, y'know
useful shit
 
Xeo
So many stupid questions about passing C++ member functions as free function callbacks... stackoverflow.com/questions/8435524/…
@DeadMG maybe you should just make that possible in WideC, e.g. automatic bind
or stuff like that
 
I will
for a start obj.func returns a function object which perfectly forwards, so it's much cleaner than in C++
 
@Xeo To allow that for C callbacks it needs to generate code at runtime.
 
but secondly, I'm using LLVM's JIT to convert std::function<ret(args..)> to ret(*)(args...)
 
6:27 PM
JITs are awesome.
 
they're immensely handy
 
Because why the hell it shouldn't generate code at runtime?
 
Xeo
Oh, I thought free functions would decay to function objects too instead of function pointers :P
Away with those function pointers!
 
they do
I don't have function pointers for any purpose except legacy interoperation
 
anyone used this lib before? netbsd.org/~jmmv/process/index.html
 
Xeo
6:29 PM
sounds good
 
I need to download it, but I can't seem to find a link
 
they're even hidden away in a minor namespace, not primitive types
 
Xeo
so anyone who needs an argument that is a function with a certain signature, they must make that function a template?
or is that solved in another way?
 
heh
first, there's std::function
but also, templates are hardly the chore they can be in C++
 
10
Q: Where is Boost.Process?

TC.I need to execute a program and retrieve its stdout output in c++. I'd like my code to be cross-platform too. Having recently discovered the wonderful world of the Boost c++ libraries for all your cross platform needs, I figured I'd just go to boost.org and read up on the documentation of Boost....

?
 
6:31 PM
note to self
- is not a shift operator
 
Xeo
@DeadMG So you're not going for "don't pay for what you don't need"?
 
Xeo
@DeadMG lol?
 
no, I'm going for "Use a template"
 
6:32 PM
that's what they're for
 
Xeo
heh
But the code bloat!!11!1 :O
@DeadMG Can you restrict functors as template arguments to certain signatures?
Or is that handled in the part where the functor will be called?
 
well, if you try and call it and the functor doesn't support it, you'll get an error
what more restriction do you want?
 
I've got that
 
Xeo
19
A: Isn't the template argument (the signature) of std::function part of its type?

XeoThe problem is that both function<int()> and function<int(int)> are constructible from the same function. This is what the constructor declaration of std::function looks like in VS2010: template<class _Fx> function(_Fx _Func, typename _Not_integral<!_Is_integral<_Fx>::...

Keyword: overloads
 
6:36 PM
not a problem for WideC
 
Xeo
@DeadMG Why not?
 
2
A: Isn't the template argument (the signature) of std::function part of its type?

Howard HinnantI've seen this question come up one too many times. libc++ now compiles this code without ambiguity (as a conforming extension).

Kewl
 
Xeo
Yes, it's awesome
 
Because you can ask the functor what signatures it has and if it supports being called
 
Xeo
6:38 PM
Did you read the discussion in the comments? :)
 
@Xeo Because it's WideC. It has everything, except problems.
 
if not, just throw a WrongOverloadError
it's like SFINAE, except you can perform arbitrary logic, including reflection, before deciding if there's a problem
 
Xeo
@DeadMG Ehm, at compile time? An exception?
 
yep
 
Xeo
Okay
 
6:39 PM
Metaception.
 
I sense some disbelief in that "Okay".
lol
 
how else would I implement it?
 
Do you have "inceptions"?
Like, objects you can throw down the call stack.
 
Backward exceptions.
 
even C++ has objects you can throw down the stack
 
Xeo
6:40 PM
@RMartinhoFernandes Yes, it's called a "function"
 
No, you're not getting it.
 
Nah, we need something better.
 
It's not a function.
 
unthrow std::runtime_error();
It's programming with time travel!
 
@CatPlusPlus We can play ping-pong on the call stack!
 
6:42 PM
Well, you could have the catch block just recalling the function that called the function in a try block, but that would result in infinite recursion
 
Still, not the same.
"Oh, boy, I failed to open that file. Here goes an exception". "What? File not found? I don't want no stinkin' "file_not_found_error". Take it back!" "Oh, the caller is not happy with a file not found. Ok, I'll create a new one."
 
Xeo
sure
 
You people are no fun. We're inventing new stuff here!
 
Xeo
Try implementing it instead of inventing it. Then I'll applaud you.
 
@Xeo Design comes first.
 
6:45 PM
Pfft.
 
void go_on_a_plane() {
    throw some_inception();
    do_stuff();
}

void do_stuff() {
    std::cout << "blah\n";
    sleep();
}

void sleep() {
    try {
        std::cout << "I never sleep on planes. I don't wanna get incepted.\n";
    } catch (some_inception&) {
        std::cout << "I was incepted!\n";
    }
}

int main() {
    do_stuff();
    go_on_a_plane();
}
 
Wonderful.
We could scare the shit out of Java programmers with this.
 
Outputs:
blah
I never sleep on planes. I don't wanna get incepted.
blah
I was incepted!
 
Meh, I'm in the middle of rebuilding Oz.
 
6:48 PM
stupid little puberty girls annoyed me in the bus. they laughed about some nonsense and told me that i would have gum in my hairs.
 
I completely forgot about it.
 
Xeo
@RMartinhoFernandes Should be try {} foresee {}, or something
 
do { } do not { } // there is no try
 
user34537
@RMartinhoFernandes: Really? Thats the output? How? I dont see a throw in the try so how would you ever get incepted.
 
6:49 PM
doesn't work! :(
 
Come on guys! Stop thinking in C++!
 
Speedy things go in, speedy things go out.
 
@acidzombie24 Inceptions go down the stack, not up.
Also, I love the verb "to incept".
 
What next should I write? That's an honest question at least...
 
6:52 PM
@KerrekSB did you actually use my useless link?
 
@keithlayne Yep, pasted it into the answer!
 
Xeo
@DeadMG Prints 5 and crashes right after on MSVC
 
crashes without printing on ideone
still not entirely sure what the issue is, I'm sure it's perfectly well defined
 
This Java typesystem confusion is worrying. Is the OP just confused, or does the language leave you no choice but to be confused? I.e., can confusion be "by design"?
 
Xeo
you dont return from call_function_as_ptr
 
6:54 PM
@KerrekSB I was thinking about actually answering some questions today, but it's pretty much impossible with you guys around. Maybe I should learn PHP.
 
good catch
 
Of course confusion can be by design.
 
now it's fixed
 
@keithlayne You can learn Java. I don't think anyone here touches those questions with a pole.
 
and it works!
 
6:55 PM
@keithlayne Don't learn PHP!
 
I'm gonna be rich and make a Boost library
 
@KerrekSB No, it's simple. It's all about type erasure.
emptyList returns a list of Object.
 
@cat don't worry about that
 
@CatPlusPlus I'm not sure it's really possible to "learn" PHP. Learning usually implies some personal betterment and attainment of a higher level.
 
6:56 PM
do do do {while(bool{});} while(int{}); while(long{}); while(short{});
is this valid!?
 
@RMartinhoFernandes But inside the generic, isn't the type parameter accessible?
 
Xeo
@DeadMG What do you return?
 
nothing, there's no need for it to return anythin
 
#define de do
do de do ...
 
@JohannesSchaublitb Let me go, before you do do, do do do, do do do do, do do do...
 
6:57 PM
what does my code do!?
 
@KerrekSB Sometimes.
 
@JohannesSchaublitb Nothing?
 
Xeo
ah, you removed the return
 
I think it's not in static methods.
 
6:57 PM
when I found out how "generics" work in Java I was disappointed
 
@KerrekSB Yes, but you can't do anything useful with it. It's an Object.
It's just automatically inserted casts all the way down.
 
@RMartinhoFernandes So the T doesn't have a deduced type?
What's this "unsafe cast" business anyway?
 
I used to have "facebook" as a favorite tag to help find questions to flag
 
Generics help you ensure you won't get InvalidCastException or whatever it's called, but that's about it.
 
@KerrekSB How can it be deduced? The function has no arguments.
 
6:59 PM
And bit less ugly syntax.
 
DO YOU AGREE?
> temporaries are not expressions, but "temporary" is a property of expressions too. When a temporary is first introduced by an expression then that expression is a temporary (that's why the spec sometimes says "an rvalue temporary", because the rvalue expression is a temporary).
 
user142019
@keithlayne haha
 
> That's so temporaryness can be tracked at translation time. Lvalues of course can also refer to temporary objects, but the only point (that I know of) where an lvalue itself is a temporary is when throwing an exception. The (synthesized) lvalue expression referring to the temporary exception object is a temporary.
 
@RMartinhoFernandes Ah, yes, that's true.
 

« first day (418 days earlier)      last day (4532 days later) »