« first day (1097 days earlier)      last day (3869 days later) » 

9:00 AM
A better example of that is the name of std::move, which doesn't actually move anything, but "they will usually be doing a move when they write it"
 
do we have to go over this again?
 
@BartekBanachewicz You asked,
 
@LightnessRacesinOrbit I didn't.
I've just stated a fact.
 
@LightnessRacesinOrbit I agree there. But given that it was already expert-friendly, and it just increases my productivity, I like it a lot
 
Type inference is good.
 
9:00 AM
@sehe nods
I'll still be using C++11 - I just kinda wish the rest of the world couldn't
2
 
@LightnessRacesinOrbit I can't really relate to that.
In my head "expert-friendly" doesn't mean "fucking painful as heck to write"
 
imagine Haskell without type inference :/
 
@LightnessRacesinOrbit You can't really go too far wrong with lvalues/rvalues. The worst that can happen is that you move an object too many times. Most people, I think, will not have a problem with lvalues/rvalues. You don't need to be a genius to write std::move now and then (although I admit it could be more accurately named).
 
@LightnessRacesinOrbit Bad naming has been in C++ from the start. Consider it a cultural requirement
 
9:01 AM
Type inference is evil. Might just as well write JS. Write only code.
 
they didn't need to make it a galaxy worse
 
@starmole when did JS get type inference? Heck, when did it even get strong typing
 
and frankly, the simple fact is that the new proper handling of rvalues opens up many new avenues of programming (like unique_ptr), lots better exception safety, as well as much better performance.
 
I'm the only one that thinks std::move's name is ok :S
 
Exactly. Just as unreadable. But easier to write for sure! :)
 
9:03 AM
@R.MartinhoFernandes I think it's OK. It could be better but it's hardly a disaster
 
@starmole what
 
I don't find any of the oft suggested alternatives better.
 
Should have been auto p = std::relinquish(q);. Or perhaps std::I_dont_need_it_anymore?
 
@R.MartinhoFernandes I think it's okay because it expresses intent. But, like sir @Lightness (rightly?) argues, that is a mismatch from the rest of the language :/
 
@starmole easier to maintain speaks more to me
 
9:04 AM
std::help_yourself.
2
 
std::enable_move
 
Oh, I know. Unary minus!
2
Think about it.
 
It expresses the intent correctly only some of the time, and expresses its own behaviour incorrectly all of the time
std::get_rvalue
 
@LucDanton Nothing stops you from overloading it to mean exactly that for your classes :)
 
std::xvalue_cast?
 
9:05 AM
@LightnessRacesinOrbit That's even more surprising, maybe as_rvalue but then _rvalue_cast would be a far better match to the other casts
 
get whatever value it is
see, I lose track of the nine million values types we have now
 
Ugh, ugh, ugh
Anyway, std::move does move en.cppreference.com/w/cpp/algorithm/move.
:P
 
ugh GNU makefiles are so fucking unreadable
 
@R.MartinhoFernandes lol. You win
 
@LightnessRacesinOrbit Yu don't really need to know them beyond l/r.
 
9:07 AM
seriously this makefile has 1576 LoC :/
 
@BartekBanachewicz disagree. But you're free to read something else. (Did you mean automake and friends? Because, you know, that's feindish stuff indeed)
 
auto x = DoStuff(); or int x = DoStuff(); Which is easier to read?
 
@BartekBanachewicz Be glad it's not 1576 B.C.
 
@sehe fiendish, and no, I mean regular huge makefile
@sehe I'd much rather hit that with a stone or a club
 
@starmole They're both horrible.
 
9:07 AM
@starmole both are bad
 
@BartekBanachewicz Bad design. A hughe SConstruct or ninja file would be equally inexcusable
 
x <- doStuff
 
Just as horrible?
 
@BartekBanachewicz missing the point about bad naming. Twice
 
@sehe I never argue about placeholder names :/
@sehe I've heard that Google is not very good at that coding thing.
 
9:08 AM
@BartekBanachewicz Readability is all about the names.
 
auto totalEntropyReported = ProcessStatistics(input, statistics_sink);
 
If you want to keep that policy of yours, you should not argue about readability.
 
I wrote an answer about this a long time ago
 
@BartekBanachewicz Then, x <- doStruff adds precisely nothing, so you deserve to get stepped upon :./
 
@R.MartinhoFernandes I see your point.
okay, okay
I get it, aight.
 
Xeo
9:09 AM
@sehe 'cept casts take the target type. At that point, you might aswell do static_cast<T&&>(myval)
 
@BartekBanachewicz I don't know why you tell me
 
now, I want to build that
 
xvalue_cast!
 
@Xeo Erm. Yes
 
9:10 AM
@sehe because I'm scared of that Makefile
 
@Rapptz I think I remember that - it's a good 'un
 
> "Let's get dangerous."
Lol. And ewwww
 
@LucDanton DIAF?
 
@Bartek: I want to see what type I'm using.
 
@LucDanton Whoa.
 
9:11 AM
/home/bajtek/arm-eabi-4.6/arm-eabi/bin/gcc: 3: /home/bajtek/arm-eabi-4.6/arm-eabi/bin/gcc: Syntax error: ")" unexpected
make[1]: *** [scripts/basic/fixdep] Error 2
make: *** [scripts_basic] Error 2
 
If nothing else, it catches errors when the return type of DoStuff changes (or isn't what I thought it was) and suddenly I get a pleasing compilation error, rather than silently a different behaviour.
We have strong typing so let's fucking use it
 
is that a syntax error in the file or what?
 
Otherwise, again, scripting language.
 
@LightnessRacesinOrbit type inference is strong typing
@LightnessRacesinOrbit bullshit.
 
@LucDanton I'll gladly take std::move any day. Maybe you could have ADL-enabled move for your Ranges
 
9:11 AM
@R.MartinhoFernandes It's a bit of history, no need to panic :v
 
anyway, is this gcc error from actual file or what?
 
@Bartek Let me know when you're ready to discuss C++ issues without you being a dick
(also without you being wrong)
 
@LightnessRacesinOrbit precisely when you stop to bend facts over to suit your points
 
I happily state facts to suit my points. Hard to bend them when they're demonstrable.
 
imagine a pipe.
3
 
Xeo
9:13 AM
@BartekBanachewicz The two are unrelated, orthogonal concepts.
 
the pipe is round
 
@BartekBanachewicz probably means the wrong type of SHELL is being invoked (not sure because no way to psychically infer the contents of said makefile)
 
that's strong typing
when you build a connector around it, it's type inference
 
Is there a car in this analogy?
 
when the pipe is made of rubber, it's dynamic typing
 
9:14 AM
@LightnessRacesinOrbit now, maybe you should pre-emptively leave this room, because your standards are just too high for mortals
 
If I weren't afraid to break everything and if I couldn't cackle maniacally as I submit insane code there'd be no point to annex. It's a playground.
 
Xeo
@BartekBanachewicz strong and dynamic also don't belong into the same bucket
 
@sehe Many denizens of Lounge<C++> are good enough to satisfy my standards :)
 
@R.MartinhoFernandes It's a pipe dream
 
9:15 AM
@R.MartinhoFernandes I did not name names!
 
@BartekBanachewicz Ceci n'est pas une pipe.
 
@Xeo eh, those are intermixed so much
 
I just think that the pipe analogy is pretty illustrative
 
Now auto is a "universal pipe connector", which doesn't really exist and is confusing to many people who try to use it
 
9:16 AM
you are awful at analogies. ;)
 
Guys, when you create a 3x3 matrix like (pseudocode): { {0,0,0} , {1,1,1} , {2,2,2} }, what is the standard way to visualize it? Is the first row in the matrix 0,0,0 - or is it 0,1,2?
Lol
:[
 
@LightnessRacesinOrbit no, auto just states that I don't want to look at the connector itself as long as it fits
 
@Omega what is this "standard" of which you speak?
 
@BartekBanachewicz But you can't make sure it fits without looking at it. And, actually, now you're prohibited from looking at it, because it is covered in a black plastic sheeting. That is the problem.
 
@Omega No one knows. You tell us.
 
9:17 AM
The only agreed-upon standard on that matter is to be explicit and tell people which convention you are using
 
@BartekBanachewicz ... and uncalled for. Tomalak knows what type inference is. He just chooses not to like it, because he draws the line of "strong typing" a bit closer; think "explicit typing" and you'll see the difference
 
Well, if you were given { {0,0,0} , {1,1,1} , {2,2,2} }, how would you draw it in paper?
000
111
222
 
I don't know.
 
@BartekBanachewicz that doesn't sound like strong typing, now does it
 
@sehe You're totes on the ball today, I must say
 
9:17 AM
@LightnessRacesinOrbit compiler makes sure
 
@Omega that depends
 
@BartekBanachewicz No, it doesn't.
 
OpenGL does one thing, Direct3D does another (or rather, each have their own default assumption). And quite often, when people use matrices in programming, they use one of those APIs
 
user1804599
@Omega However you want.
 
@LightnessRacesinOrbit Oh gawd can you not indulge him in the pipe thingy?
 
9:18 AM
Thank God
 
@sehe it does. The socket has an explicit type
 
in math element(i,j) is i=column, j=row
 
@R.MartinhoFernandes :P
 
user1804599
It’s up to you how you define the data structure.
 
I thought I getting mad
 
9:18 AM
but you don't need to know the socket type
you can simply try plugging the connector
if it doesn't fit, it won't go in
in dynamic typing, it would go in and cause shock hazard
 
@BartekBanachewicz are you describing duck-typing now?
 
@BartekBanachewicz but it's not stated, so the compiler doesn't verify your expectations. Verbosity is worth something (I don't agree, but I can see the point)
 
now you have to make up your mind if you are storing rows or columns
 
@jalf pipe-typing.
 
user1804599
Write a tensor class template.
 
9:19 AM
In computing, row-major order and column-major order describe methods for storing multidimensional arrays in linear memory. Following standard matrix notation, rows are numbered by the first index of a two-dimensional array and columns by the second index. Array layout is critical for correctly passing arrays between programs written in different languages. It is also important for performance when traversing an array because accessing array elements that are contiguous in memory is usually faster than accessing elements which are not, due to caching. Row-major order is used in C/C++, PL/I...
 
@sehe well, I don't need to state the type for a function explicitely in Haskell for the compiler to still verify it
 
So there IS a standard way
:0
 
@BartekBanachewicz but then the Haskell compiler doesn't verify that the type is what you thought it was -- only that it is compatible with the rest of the program
 
Haskell has stronger guarantees because it does not allow overloading or implicit conversions.
 
@BartekBanachewicz The compiler verifies that it is well-formed or "sound". Not that it matches anyone's expectations. In an exper-friendly language this matters (and IMHO it matters in Haskell too)
 
user1804599
9:20 AM
Fuck jagged arrays for matrices.
 
@R.MartinhoFernandes And that
 
@jalf and I think that "blackbox typing" is a good thing
@sehe it's up to you to build your types so that improper usage of them would fail at compiletime. Also in C++ (or maybe even more in C++)
 
@Omega No, there are two. Look further down on the page. It also describes column-major order
 
@sehe It doesn't really matter as often in Haskell because things there always mean the same regardless of context (assuming non-pathological class instances). If you change something, and it still compiles, it probably still works.
 
:12405257 Lol - too late. I was already planning on putting the guy out of his misery as everyone started to confuse him
 
9:22 AM
@BartekBanachewicz I'm pretty sure that "what you personally think is a good idea" wasn't really what was being disputed
 
#include <iostream>

struct A { void bar() { std::cout << "Expected outcome :)"; } };
struct B { void bar() { std::cout << "Unexpected outcome :("; } };

A foo(int)     { return A(); }
B foo(char)  { return B(); }  // someone created this without telling me

int main()
{
    auto x = foo('0');
    x.bar();
}
 
@R.MartinhoFernandes Agreed. It matters a lot less in Haskell.
 
I called the wrong function, and now x has the wrong type, and at compile-time I have no idea whatsoever
 
@LightnessRacesinOrbit you called the right function, it's still called foo
 
Xeo
We had this before. Overloading sucks.
 
9:22 AM
@LightnessRacesinOrbit Woot for succinct demonstration
 
now, if you're showing me an example of malicious code...
 
"being explicit about types allows the compiler to check that the type is what the programmer thought it was" - "no it doesn't , because I don't like languages that do that"
logic~~
 
@BartekBanachewicz lol. Way to go. Hope you don't support my production code with that logic
2
 
what the hell
 
9:23 AM
@BartekBanachewicz And bar is wrong?
 
Has @Bartek only ever written twenty-line programs?
 
It just happened to share the name with the other one.
 
Also that's a fault of C++ implicit conversions
 
Xeo
@LightnessRacesinOrbit That's not a problem with auto, but with bad overloading.
 
9:24 AM
It's a problem with bad overloading, and it's made worse by auto preventing its diagnosis at compile-time.
 
@Xeo Meh, same with changing the return type of A without involving overloads.
 
so it's a whole another problem
 
@BartekBanachewicz You know. It doesn't matter whose fault it is. It's reality.
 
auto is fine in a perfect world where you have no bugs or problems.
 
It turns breaking changes into successful compilations.
 
9:24 AM
@LightnessRacesinOrbit i.e. in Haskell
 
@Xeo I do agree there too. But that, also, is reality
 
meh for "reality prevents us from introducing nice concepts"
 
@BartekBanachewicz Did it? Check again: reality has auto!
 
So auto is theoretically very pleasing, but in practice it's just a disaster waiting to happen. And, really, for what? Use using to shorten long type names, and move on.
 
@LightnessRacesinOrbit or just move to Java and save us the rant on C++11.
 
9:25 AM
Why would I want to use Java?
 
Never save rants.
 
@LightnessRacesinOrbit because it seems to fit your ideas way better.
and that's not sarcastic
 
I don't think I'm ranting; you're ranting about how the world is perfect and nobody ever has bugs in their 20,000-file codebases and auto will never go wrong. I think your head is still firmly stuck up your local clouds.
You tend to fail to see the bigger picture, or all the cases, IMHO xx
 
Maybe it's just that auto should be banned in large codebases, then, huh?
But then again, more things should be kept strict in large codebases, IMHO
 
Wait, now you're relegating auto to demo code only?
 
9:28 AM
not demo.
he said 20k of files, perhaps spanning over decades
 
Or spanning over six months
 
6 months is nothing.
 
Six months is not nothing. Six months is six months.
What are they teaching you people these days?
 
you could still be sane after 6 months of javascript
 
I very much doubt it...
 
9:29 AM
I'd love to see one or two of those hypothetical auto bugs related to legacy code
 
Wait what is this about, now?
 
About the fact that through a longer period, even innocent things can easily turn into bugs
 
@jalf I don't think they'd be very common, but still don't want to side with Bartek's absurd certainty.
 
So it's always a strike for balance of speed of production vs bug-freeness
 
Any 'bug' available to auto is available to template<typename T> totally_not_auto(T);. (I'm going to ignore the std::initializer_list wtf-ness.)
 
Xeo
9:30 AM
@R.MartinhoFernandes I just don't see that. If it's really a breaking change, the new return type really shouldn't be exactly the same interface-wise, no?
 
@BartekBanachewicz No. It should be used judiciously. And fear of that being forgotten is a valid reason for someone to dislike the language feature.
You don't need to agree
 
@jalf auto as automatic storage duration
 
@R.MartinhoFernandes what was his absurd certainty again? That auto should always be used whenever it is syntactically valid?
 
Xeo
@LucDanton I gave that argument before.
 
@Xeo C++ interfaces don't say everything. It could be the old function only returned positive values and now this one returns negative ones too.
@jalf No, that it will never be a problem.
 
9:32 AM
@Rapptz those wouldn't even compile, though, would they? (since they'd take the form auto <typename> <name>, and would not be valid under the new auto)
 
Xeo
@jalf implicit int :D
 
@Xeo oh god.
 
Xeo
And not even then
 
@Xeo No such thing in C++.
 
@jalf True.
 
9:33 AM
That horrifying moment when you realize that there are ~200 singletons in the project you are working on. Implemented in a way that they are prone to static initialization order fiasco, deriving from each other and more of that stuff.
 
lol, deriving from singletons.
 
Xeo
5
A: What breaking changes are introduced in C++11?

Lightness Races in Orbitstruct x { x(int) {} }; void f(auto x = 3) { } int main() { f(); } C++03: valid. C++0x: error: parameter declared 'auto'

 
I just think it is less readable. auto x = DoStuff();. Now I have to look up the declaration of DoStuff to know what x is.
 
Xeo
(Fun, it's from Tomalak)
 
@R.MartinhoFernandes You mean that because of auto specifically, a different function may end up being called, which has incompatible semantics? Sure, it can happen in theory. I'm just questioning in what real-world scenarios that actually happens
 
Xeo
9:34 AM
@starmole Think in interfaces, not types.
 
@starmole And with int x = DoStuff(); it is clear? What is x exactly?
 
@starmole That is only true for some situations. In other situations it improves readability. Think auto it = vec.begin(), you know it is an iterator.
 
> make[3]: gfortran: Command not found
Did not expect that.
 
(And unless you say "the x coordinate of stuff", I don't want to hear your answer)
 
@starmole The entire point is that you shouldn't have to know the concrete type of x. Only that it meets the correct interface.
 
9:34 AM
We can all intentionally write code that would break by adding an auto. Just like we can write code that breaks on any other change.
 
@starmole well point about giving x meaningful name still holds
 
@jalf Oh, I agree with that.
 
i just know people will use it like that :)
 
Also, is anyone seriously saying "programmers should go through all their legacy code, and, while making no other changes, blindly replace typenames with auto anywhere the compiler will let them"? Because if not, then this whole thing seems kind of overblown
 
@starmole It won't make a difference then. Those people are already writing unreadable code today.
 
9:36 AM
When reading other peoples code, you do want to know the type
 
@starmole no I don't. I just want to know what the variable is. I may care that it represents the width of a window, but I don't give a fuck if it is an int16_t or const uint32_t&
 
"If you write unreadable code and put auto it is unreadable" is not an argument against the readability of auto. Stop being stupid.
@starmole Good. Tell me what this code does: int x = f(); int y = g(); int z = h(); return x * y + z;.
All the types are right there.
 
iow, variable naming is a pretty cool language feature
 
You must be able to know what it is. Right?
 
<silence.../>
 
9:38 AM
It returns an int.
 
@jalf Agree. I just want to know where did I get it, the operations I want to use on it, and where I want to pass it (if I should).
 
@starmole That's what it does?
int returns_an_int() {
    int x = f(); int y = g(); int z = h(); return x * y + z;
}
 
yes.
 
Magnificent. Perfectly readable code.
 
@starmole So, if it had been instead int x = DoStuff(), then you would magically know something about the result of calling DoStuff()? You'd know stuff like what the number means, or which particular values it might take? How, exactly, woudl this knowledge come to you, without looking up the definition of DoStuff()?
 
9:39 AM
@starmole []{return 42;} is equivalent code, then
 
user1804599
 
@starmole In that case, may I propose a refactoring and optimization? Replace it with int returns_an_int() { return 0; }
So much more readable, and faster too
 
@not-rightfold you odd
 
I wonder how much more nonsense code I can keep writing and have people claim it is not unreadable.
 
> The global namespace posix is now reserved for standardization.
Oh. That's a weird one
 
9:41 AM
switch all the int to unsigned... it has a different meaning
 
@starmole It's still a number. :P
 
unsigned returns_an_int() { return 0; }?
 
@R.MartinhoFernandes Don't use std::tuple, use out values. Don't use optional, use out values.
 
@starmole so the type is the only thing you care about? It doesn't matter if the function returns 0, 1, -12632 or 17. All the programmer needs to know is that it returns an int?
 
9:41 AM
or maybe x and y are string classes where * is cat?
 
unlikely, but just much easier to parse if the type is on the line i am reading
 
Does it fucking matter? You still have no idea what the function does.
It is still totally nonsense code.
 
@starmole I assume that all functions you write then take the form T return_a_t() { return T(); }? If the only meaning you assign to a function is "the type it returns", then doing anything more in any function is clearly unnecessary overkill
 
And the fact that you are still trying to claim it isn't is just baffling. Are you a troll?
 
9:43 AM
@jalf Again, a bit slow :)
 
@sehe I know :(
 
user1804599
-4
Q: Why hasn't anybody got time for that?

GrayhamCrayonEvery time I ask someone to do something apparently 'aint nobody got time fo dat'. Please help me find out the reason.

 
no need to get that excited
all good people have good uses for auto
 
Give me an example of readable code with type names, and I'll give you an example of readable code without type names.
 
well, depends on POV
@starmole unrelated. Everybody has a use for good naming, though
 
9:45 AM
i am just worried that it will make things less readable for me
 
> "just worried"
 
int x = DoStuff(); is not readable because no one has any fucking idea what the fuck x is.
 
That'll stop you from improving
 
@R.MartinhoFernandes and what DoStuff is
 
Shitty examples strike again :/
 
9:46 AM
Worse: shitty defenses thereof
 
As I explained to Bartek above, you cannot discuss readability if you don't pay attention to names.
 
undefined message?
 
Hey guys :)
 
I can make a function cat that does things to dogs; names don't solve it
 
9:47 AM
@victory Oh hey. How's RPC going
 
oh god that avatar
 
@ sehe, I am using normal sockets with OpenSSL
 
@LightnessRacesinOrbit That doesn't sound like good naming to me :S
 
^ my friend reverse engineered the MS implementation. Maybe you'd be interested
 
9:47 AM
@R.MartinhoFernandes It isn't
 
Then there's nothing to show about auto.
 
@victory (seriously, if you're into pen-testing and related, you might want to read that book for good info (or maybe another one on the subject))
 
Whoever made the example here must have been pretty angry.
 
Practical example. I worked on a huge legacy code base with at least three different Rectangle classes. And functions returning not the ones passes in etc.
 
@Rapptz who said anything about naming :/
 
9:50 AM
If people had used auto I imagine it would have been much harder to refactor
 
has anyone used arm-eabi-gcc?
 
@sehe My project I am developing atm doesnt have to do anything with Pen testing. though I coded lots of scripts based on public exploits to automate the exploitation in ruby and python
 
because I have little to no idea how that beast works
 
@starmole Again, program to concepts ("interfaces"), problem solved. See, e.g. stackoverflow.com/questions/19350299/… - it uses a user-defined point type and all the algorithms just-work
In fairness, that might be hard to pull of in a legacy codebase (definition: code without tests)
 
It'll take ten or so years for auto to accumulate in big code bases until it becomes a problem
 
9:54 AM
The problem you described already existed before :S
You just say it was in a legacy codebase.
The problem is already there.
 
@starmole Ah good. I'll plan my retirement accordingly <evil-grin/>
 
If everybody writes good code and test JavaScript is fine :)
 
People don't fucking name things properly.
In a way, auto forces you to do so.
 
I think I've mentioned before that I wish we had explicit for regular functions right? :(
 
Xeo
What would that do? :P
 
9:56 AM
If the original foo was explicit A foo(int) then foo('c') wouldn't have compiled in the first place.
 
Don't ask what I'm doing - not that it's a big riddle
 
I don't see how auto helps? I see it used by either the expert for write only code or the new guy who is too lazy to even figure out the right type.
 
@starmole here and all the corresponding comments to the questions and answers.
 

« first day (1097 days earlier)      last day (3869 days later) »