« first day (858 days earlier)      last day (4075 days later) » 

8:00 PM
Website blocked by Trend Micro Worry-Free Business Security
Restricted website blocked
http://www.cppgm.org/pa1.html
Category: Spam
What You Can Do:
Contact your administrator about security settings on your network
 
@MooingDuck :D
 
Xeo
@Zoidberg I was going to suggest var h = from p in method.GetParameters() skip 1 select Convert.ChangeType(groups[p.name].Value, p.ParameterType);, but it seems in LINQ there's no skip literal. :(
 
That's that whole CPP Grandmaster thing.
 
user142019
@Xeo I really hope they support more LINQ features in query expressions in C# 6.0.
 
> It was reported that 10,000 programmers have enrolled in the course including people from Intel, Stanford, Google, MIT, IEEE, Harvard, and many other companies and educational institutions from all over the world.
 
user142019
8:01 PM
I really miss things like top/first and drop and such.
 
@Griwes a joke
 
user142019
In Microsoft SQL you can do SELECT TOP 50 PERCENT. :)
 
@Griwes : Which course are you talking about?
 
@ScottW he he he
 
user142019
Really neat.
 
8:02 PM
@thecoshman Like I really cared.
 
user142019
I find query expressions much more readable than method syntax.
 
@Zoidberg there is take and takewhile, idk if that is what you want
 
user142019
The syntax is much lighter.
 
user142019
@JohanLarsson no I want drop aka skip. :P
 
but you have skip?
 
Xeo
8:03 PM
Not in query syntax.
 
user142019
Not in query expressions.
 
ah ok
 
user142019
There is Skip but that requires method syntax.
 
Xeo
I mean, you could always do var h = (from x in xs select Convert.ChangeType(...)).Skip(1), if the first element is valid.
 
user142019
Also I should cache the routes.
 
user142019
8:04 PM
They can never change anyway.
 
you can format your method syntax with newlines to make it a bit more readable
 
user142019
@Xeo I don't really like mixing the syntaxes.
 
Xeo
No
 
user142019
arguments.AddRange(method.GetParameters()
    .Skip(1)
    .Select(p => Convert.ChangeType(groups[p.Name].Value, p.ParameterType)));
 
user142019
))) Lisp!
 
Xeo
8:05 PM
std::vector<std::vector<T>>.
But you normally don't want that either.
 
user142019
@Xeo What was the question?
 
Xeo
@ScottW Welcome to 2011.
 
user142019
I hate using an array of arrays to represent a 2D array.
 
user142019
(They're different things.)
 
user142019
(And a vector is also an array in this context.)
 
Xeo
8:05 PM
Were we don't give a fuck about >>.
49 secs ago, by Xeo
But you normally don't want that either.
 
user142019
@Xeo Didn't compilers already implement >> for templates like five thousand years ago?
 
Xeo
@Zoidberg That aside.
 
user142019
:P
 
Yeah I never did > >
 
user142019
Me neither.
 
user142019
8:06 PM
Because I started learning C++ when C++11 was nearly there.
 
@Xeo I was just curious
 
user142019
And I didn't use templates before C++11. xD
 
Xeo
@Zoidberg Also, GCC didn't really.
 
user142019
olol
 
I started programming in C++ a long time ago too, I'm pretty sure >> was valid back in early versions of VC++
 
8:07 PM
@Griwes would you rather a genuine answer?
 
I think it was fixed in 2008.
 
@Rapptz it was only in 11 when the compile could treat >> as closing of two templates and not the operator. (note the lack of space)
 
user142019
 
user142019
This is one nice song IMO.
 
@thecoshman We're talking pre-C++11
 
8:08 PM
@Zoidberg no it is not
 
user142019
@Washu yes it is
 
@Rapptz compilers may have allowed it, but it was not standard, AFAIK
 
user142019
VS is fast as hell on my machine. I don't understand why and how.
 
@Zoidberg bit dull
 
@thecoshman I don't understand why the standard has to standardise it though
 
user142019
8:09 PM
Verenigde Studio
Visual Staten
 
@Rapptz why standardize any part of the language?
 
user142019
@ScottW poor you.
 
user142019
Y u no upgrade to VS 2012.
 
@Rapptz because before that '>>' had to be the operator. Yes this was an over-site, but people could have written stuff along the lines of... templatefoo<templatebar< function_using_operator>> >> (or something to that effect)
 
@MooingDuck I fail to understand what that has to do with basically standardising parsing.
by that logic why can't < and > have to be operators?
 
Anyway, I'm glad the change is there. I just think it's a stupid mistake and silly in general.
 
@Rapptz The rule is here to disambiguate e.g. a+++b.
 
@Rapptz precedence perhaps? I am no standard anal-ist
 
Say hello to Max Munch.
 
@Rapptz None of this is really parsing at all -- it's lexing (tokenizing).
 
8:15 PM
@JerryCoffin Yeah, sorry.
 
@LucDanton is the answer to 1) potentially unlimited? (for some reason I thing that operator++ can return an object that you could call it on in a chain) otherwise, five
 
@Rapptz As to why standardize it: so the meaning of a program is known. This was a breaking change in C++11 -- some code defined in C++03 now has a different meaning (and other code that was legitimate in C++03 should no longer compile. Defining what's allowed and what acceptable code means is pretty much a short description of the reason the standard exists.
 
@JerryCoffin Can you give me an example?
 
@thecoshman Wrong person? (I have no idea what you are talking about...)
 
I ask because I don't see how > > instead of >> on templates is a breaking change and invalidates older code. I'm pretty sure I can still do the former and it'll compile fine in C++11.
 
8:19 PM
@Rapptz foo<16 >> 1>
 
@StackedCrooked lol. wrong person indeed
 
@LucDanton I think that lookup should be able to solve that problem easily.
 
@thecoshman Are you saying that's not answered in my link?
 
For example, 16 is not a template.
Therefore, it should do bitwise shift.
 
@LucDanton is it?
 
Xeo
8:20 PM
@ThePhD And now welcome to the generic template world.
 
Generic template world?
 
Xeo
Where things aren't what they might look like.
 
@Rapptz See here
 
@Rapptz At least if memory serves, the proposal paper had some examples.
 
@Griwes ?_?
 
8:21 PM
template<bool Test> class SomeType;
std::vector<SomeType<1>2>> x1;  // Interpreted as a std::vector of SomeType<true> 2>,
// which is not legal syntax. 1 is true.
std::vector<SomeType<(1>2)>> x1;  // Interpreted as std::vector of SomeType<false>,
// which is legal C++11 syntax. (1>2) is false.
 
I don't understand. If the expression before a bitwise shift or comparison operator in a template expression is NOT a template itself, it should overload to the best compile-time operators it can to resolve the expression.
 
Xeo
X<Y >> Z>(A) -> (X < Y) >> (Z > A)
 
@Rapptz There's an anchor in that link.
 
@LucDanton oh, I was right, unlimited :D but I think my reasoning was lsightly off
 
@ThePhD lexer decides if that's >> or > > long before it knows if foo is a template.
 
8:22 PM
@Griwes It's showing C11 for me.
 
@Rapptz "Right angle bracket".
 
Hm. I see.
 
@Rapptz Meh, it boxed in weird way.
The link is still right.
 
@MooingDuck That's a problem of the lexer and the parsing, not really the problem of the language. As far as I would implement it, base-type parsing should be done before you start trying to resolve templates.
But maybe I just think about these things weird.
 
Wait. That example is irrelevant :F Nevermind me.
 
user142019
8:24 PM
So, I'm gonna abuse expression trees for generating HTML.
 
user142019
Because screw Visual Basic.
 
@ThePhD Normally, the first thing you do is tokenizing -- and the problem here is that it's making tokenizing context dependent (i.e., the tonenizer needs to know the context to decide whether to treat >> as one token or two).
 
user142019
Or hmm I could also abuse operator overloading.
 
@JerryCoffin But you could also just treat token content as non-constant.
E.g., break up and smash tokens if it fits the purpose of the program later on.
I wonder if there's a way to get the underlying type of an enum at compile time...
 
also why is raw string R"delim()delim"
who thought that was a good idea :(
 
Xeo
8:27 PM
@StackedCrooked ?
 
@ThePhD Yes, you could. In essence, at that point you have a backtracking parser. Those who worked on Fortran almost universally decided they were enough of a nightmare that it was better to avoid that though.
 
Xeo
@Rapptz What do you think is wrong with that?
 
user142019
@Rapptz IMO it should be R"delim()miled".
 
user142019
Looks better. :)
 
@Xeo R"()" is a bit strange compared to.. say R"" or @"" etc . I also don't understand the point of the delimeter?
 
8:28 PM
@JerryCoffin Then the other option is to have a context-sensitive tokenizer.
One that can at least guess at types.
 
@Zoidberg Even that guy who originally invented that (in Algol) has pretty openly stated that it was "too clever" and should never have been used.
 
@Xeo Cool!
 
The first pass would generate typing information for everything possible. The second pass would begin tokenization, and use the typing information to resolve any possible tokenization ambiguities.
 
Xeo
Yeah... start collecting type information before you even know what is what. o_O
 
@ThePhD std::underlying_type
 
8:30 PM
@ThePhD There is a third option (the one I think should have been taken): avoid the whole mess by defining the syntax differently to start with (i.e., not reuse angle brackets for this purpose).
 
if your symantic analyzer is non-recursive, you could put things aside and come back to them later
 
Puns are punfull.
 
@JerryCoffin True enough.
While I am fond of <> for templates,
 
ALL OF THESE CONVERSATIONS THAT I GET INTO OR OVERHEAR THAT INSINUATE SEX AND ROMANCE NECESSARY FOR BEING A HUMAN.
 
I think maybe something else would be nicer. Maybe template [] instead ?
 
8:31 PM
@ThePhD Yes, I just love the idea of an NP-complete compiler. After all, C++ compilers are much too fast now.
 
@ThePhD ew
 
@Rapptz You have a better idea? D:
 
if you hit a name you've never heard of you could put that "node" in another stack and resume processing the main stack. once main stack is drained you can restart at the deferred items
 
template b()d , lol
 
@ThePhD Unicode bananas obviously.
 
8:32 PM
Hm.
These are all things I'm going to have to think about when I invent my own useful language.
 
could also use {} but I prefer <>
 
Bleh, {}
 
by then the name is probably resolved so you will iteratively reduce the name ambiguities until there are none left
 
@JerryCoffin I see your point, I suppose...
 
@ThePhD template $typename T$
 
8:33 PM
@Rapptz That actually looks pretty.
 
user142019
Okay I quite like this. gist.github.com/daknok/4999337
 
And $ is not an operator
 
user142019
Except for the news all over the place. :c
 
template ## too, oh wait no that's for the others...
 
@ThePhD I was kidding. I hate languages with dollar signs.
 
user142019
8:34 PM
@Rapptz ambiguous when nested.
 
@Zoidberg Really?
Oh, wait.
You never know if it begins or ends.
 
user142019
:P
 
@ThePhD durr. Bad PhD.
 
@Xeo Compile-time analyzing strings mean that I can let the compiler check for spelling errors in my documentation :D check("This is nt an erro."). :D
 
@Rapptz ;~; shush.
 
Xeo
8:35 PM
@StackedCrooked Eh....
 
template \Meow/
LOL that looks HORRENDOUS.
template <> looks best. :c
 
@Xeo Just kidding.
 
OOH
MAYBE A DOUBLE TOKEN
template <. typename T .>
Or <: :>
Smiley faces~
I like the double-token. It solves the problem quite nicely.
 
C++ parsers generally have a hand-made lexer. you could simply set a flag (from the parser) when you enter a template definition and prevent >> from matching.
 
Xeo
How about no delimiters at all! Haskell can do it, so why can't we?
 
8:37 PM
I don't like delimeter-less languages,
because then you have to come up with some special spacing or tabbing scheme to make it work out. :c
 
Xeo
I hate the slew of delimiters at the end of something... )))); or >>>, anyone?
 
user142019
 
Albeit I have no idea how Haskel works.
 
@Xeo How about parens for everything? If Lisp can do it, why can't we?
 
@Xeo pfft only 3?
 
Xeo
8:38 PM
@JerryCoffin Because ((((( looks fucking horrible. :/
 
@Zoidberg new, new everywhere. :D
 
Xeo
@Rapptz If I get more than 4, I refactor with a using alias.
 
SO MANY SQUIGGLES
You know, @ThePhD, you and @Cat are made for each other.
 
template /* STUFF */; struct/class <---- maybe like that?
 
I agree though, using <> for templates was idiotic lol
 
8:39 PM
@EtiennedeMartel I don't know about that.
 
@Zoidberg what is the point of having the awaits there?
 
I like <> for templates though
 
@doug65536 Why?
 
user142019
@sehe My app is based on async.
 
@LightnessRacesinOrbit explosion of ambiguities
 
8:39 PM
@ThePhD You both got The Squiggle.
 
@Zoidberg Hammer, meet nail?
 
user142019
Huh?
 
You cannot (usefully) base an app on a technique
 
@JerryCoffin I mean, think about it. We already have template telling us that we're starting a template expression. Why don't we just separate it with a space and then have a template-ending kind of deal ( like ; or similar? )
 
@sehe You can if you're a Hipster Programmer.
 
8:40 PM
@Zoidberg it's like saying "My program is based on std::shared_ptr"
 
template<int badIdea = 256 >> 2> void foo() {}
 
Xeo
typename foo::template bar<...>::type <3
 
@Xeo Hardly ever have more than a couple of open parens next to each other. It's close parens that end up as a huge cascade. Of course, McCarthy's original intent was rather different -- Lisp was supposed to use M-expressions (which also use [ and ]) but S-expressions were in wide use before M-expressions got implemented.
 
So it would then just be template[WHITESPACE]typename T, int v; struct bettertemplate {};
 
user142019
All I/O must be async because all requests are handled on the same thread.
 
8:41 PM
@EtiennedeMartel TBH I think he means: "I'm trying to get as much use of async as possible, just to see when it works and how it might make sense"
 
I really like the bracketless template syntax.
 
@Zoidberg Mmm. I never knew it worked like coprocedures?
 
I think I'm gonna stick with it.
 
Xeo
@sehe s/async/math/ and you have Haskell!
 
I shall write that down for my language ideas.
 
8:41 PM
@ThePhD Things like that have been done too (e.g., see Forth).
 
@Xeo The good news is, math is not a technique
 
@JerryCoffin Ooh, Forth, Cat was talking about that.
@JerryCoffin Syntactically, do you like it?
template typename T, int I, bool arf -> struct <--- I like this syntax even more
Maybe instead of -> I can have just a '.'
 
@ThePhD It's not bad (pretty nice, really) if you use it constantly, but sucks if you only look at it occasionally.
 
Xeo
@ThePhD Nope.jpg
 
Aww.
 
Xeo
8:43 PM
To both of them.
 
@Zoidberg in that gist, since the HTML tree creation isn't async, wouldn't that guarantee that the future would be awaited immediately to get bugs.Select(....)?
 
@Xeo Well, what would you prefer? Assuming you lost the ability to use <>
 
@sehe That's reasonable if the goal of the project is to learn something new.
 
ThePHD's idea of making it a bit like a statement before the declaration is very elegant.
 
@EtiennedeMartel I hope it is the case :)
 
8:44 PM
@doug65536 Not really.
 
user142019
@sehe oh right. :L
 
Xeo
[], I think, since you can't have the closing version without the opening version. As such, no ambiguity with the template parameter list delimiters.
 
@sehe It's always the case when talking about one of Zoid's projects. It's not like he's gonna ship anything anytime soon.
 
user142019
I need async LINQ!
 
Xeo
Although () and {} would work too.
 
8:44 PM
@Zoidberg PLINQ, anyways, await should work. You could just await the whole HTML generation function
 
linq is async. if you loosely define async. it won't do any work for items you don't fetch
 
user142019
await bugs.SelectAsync(...) should work, but I have to write it myself. :P
 
@sehe You beat me to it.
@doug65536 No. It's deferred, but not async.
 
If you make a typi you moght end up with PLONQ.
 
yeah, deferred is more accurate
 
user142019
8:45 PM
@sehe await only works on async methods.
 
@Xeo I could see template {}
 
@Zoidberg So... make it so!
 
user142019
@sehe I cannot modify Enumerable!
 
I mean, it'd at least follow the same rules as structs and classes
 
user142019
I need to make extension method SelectAsync. :P
 
Xeo
8:45 PM
@Zoidberg Extension method?
 
collection.AsParallel().Select(etc...) is async though
 
@LucDanton Vs lbh znxr n glcv lbh zbtug raq hc jvgu CYBAD.
 
user142019
@doug65536 how does that work?
 
template {
     typename T;
     int GetCount;
}
struct {

};
^ Messy, but parsable.
 
@doug65536 it is actually (potentially) parallellizing, not async
 
8:46 PM
@sehe Yep, you still have to wait at the end.
 
user142019
@doug65536 that's not async.
 
it will be if you don't ask for AsOrdered
 
@doug65536 No.
 
user142019
I need await and async no matter what.
 
You don't seem to understand what "async" means.
 
8:47 PM
you also need to touch it
 
"async" isn't a synonym for "concurrent" or "parallel".
 
user142019
I'm not talking about asynchronity in general.
 
user142019
I'm talking about async, which is a C# feature.
 
I know exactly what async means. you start the operation then forget about it and do other work until it's done
 
user142019
8:48 PM
I'm not talking about that.
 
oh ok
 
@doug65536 PLINQ calls act as a barrier.
 
@Zoidberg Well, I think that's a useful definition, anyways
@EtiennedeMartel That's the point, indeed
 
You cannot do other work while the query is being processed.
 
user142019
It (ought to be) parallel, not concurrent.
 
8:49 PM
(barring other threads)
@Zoidberg cough. not async?
 
@Zoidberg It's concurrent, assuming you have enough cores.
 
are you forgetting that you fetch items one at a time? you think it waits around for you to get each item then does a flurry of threads?
 
in PHP, 11 mins ago, by PHP NooB
@TheWebs are you a pickle puffer? you look like one. no offence.
^ ah okay. "no offense". Good!
 
user142019
Anyway.
 
The query will get blasted into smaller chunks that'll get spread on a bunch of workers that might execute concurrently on separate thread.
 
8:50 PM
exactly, chunks. so the next N fetches from it will be instant
 
@doug65536 You still have to wait.
 
Patience
 
The PLINQ call is not asynchronous.
 
we're arguing semantics. I know what you mean. I know PLINQ not truely asynchronous, but there is significant overlap of processing.
 
@doug65536 Sure, async is generally implemented using threads.
But using threads does not necessarily make it magically async.
 
8:52 PM
@sehe Yup. Fixes anything, right?
 
user142019
new tbody(
    await bugs.SelectAsync(b => new tr(
        new td(b.Id),
        new td(b.Title)
    ))
)
 
user142019
I should just implement that method.
 
@JerryCoffin Reminds me of those "I'm sorry but" things. Usually the person saying it isn't sorry.
 
user142019
But I have no idea how. xD Oh well I'll see.
 
@JerryCoffin Yeah sure. No problem.
 
8:52 PM
@EtiennedeMartel Exhibit A: std::async, aka OMG THIS PIECE OF SHIT IS SO BROKEN.
 
@EtiennedeMartel I've noted that as well.
 
@R.MartinhoFernandes Really?
 
@R.MartinhoFernandes Ohai
 
user142019
Hmm wait.
 
await :)
 
user142019
8:53 PM
:P
 
@EtiennedeMartel std::async(std::launch::async, f); std::async(std::launch::async, g); runs f and g sequentially, but each in its own thread.
There's more in the transcript.
 
user142019
If I return from FetchBugs and IEnumerable<Task<Bug>>... :P
 
user142019
Then I can do:
 
If you have a non-templated class that is defined as only a header,
and you include it once in one .cpp,
and then again in another .cpp,
 
Xeo
Seriously, my neighbours... They seem to think it's a great idea to start drilling at 9:50 pm.
 
8:54 PM
@R.MartinhoFernandes Well, without a scheduler, you can't ensure proper scheduling or work tasks.
 

std::async is broken

Dec 17 '12 at 15:28, 51 minutes total – 137 messages, 9 users, 2 stars

Bookmarked Jan 18 at 11:22 by R. Martinho Fernandes

 
is that a Linker Violation?
 
@EtiennedeMartel Not the issue. It's an interface issue. It could just launch a new thread for each and not wait for it to end.
 
user142019
IEnumerable<Task<Bug>> bugs = FetchBugs();
new tbody(
    bugs.Select(async t => new tr(
        var b = await t();
        new td(b.Id),
        new td(b.Title)
    ))
);
 
Xeo
I wish ConcRT was standard. :(
 
8:55 PM
It _is_ great.
Great courage.
@Xeo I wouldn't be ConCRNT at all :)
@ThePhD "Or are you just happy to see me"?
 
I don't get the reference. :c
 
@Zoidberg Still far too fine grained. Run a profiler once. Maybe.
 
user142019
Oh wait that would never work fuck. It's syntax error xd.
 
This level of concurrency will only slow stuff down. Unless the latency on getting any single bug is hughe (seconds)
 
Xeo
@sehe ConcRT is awesome. With current async, I have to manually make sure not to oversaturate the user's system with tasks, with ConcRT you can just blast away async and it will make sure at runtime that the appropriate number of threads is spawned.
 
8:57 PM
Oh. I forgot it's about throughput, not efficiency here. And about work sharing.
 
user142019
sfdg
 
Xeo
If my neighbours are still drilling past 10pm, I'm gonna get mad.
 
@ThePhD it's just a recurrent joke in pop culture. It's a reference to an erection. Usually goes like "Is that a <something> in your pocket, or are you just happy to see me?"
 
@Zoidberg Sorry, I already corrected myself ^
 
Right, so, what happens if the future goes out of scope before the end of its thread?
 
8:58 PM
@R.MartinhoFernandes ... Oooh. ... I don't really get it though. :c
 
user142019
IEnumerable<Task<Bug>> bugs = FetchBugs();
new tbody(
    bugs.Select(async t => {
        var b = await t();
        return new tr(
            new td(b.Id),
            new td(b.Title)
        )
    })
);
 
@Xeo Sounds legitimate. I always set a mental deadline before getting worked up. Helps me (a) stay cool (b) feel justified to move into action
 
user142019
Eww so fucking ugly. xD
 
user142019
I want let bindings. :<
 
@EtiennedeMartel Whenever the future's destructor runs, the thread where that destructor is called blocks until the task is done.
 
8:59 PM
@Zoidberg Only {...} make it ugly all of a sudden :)
 
user142019
xD
 
@R.MartinhoFernandes Oh.
 

« first day (858 days earlier)      last day (4075 days later) »