« first day (466 days earlier)      last day (4482 days later) » 

7:00 PM
@Xaade I know, right.
 
@RMartinhoFernandes oh wow, I'm reading the libc++ header synopsis and n3290 side by side
 
@Cat Plus Plus "From Wikipedia: Under this definition, encapsulation means that the internal representation of an object is generally hidden from view outside of the object's definition. Typically, only the object's own methods can directly inspect or manipulate its fields."
 
@Als I have lots of friends, here.
 
@jisaak You're still missing the point.
 
why can't all operators take more arguments like new/delete can?
 
7:01 PM
tell me
 
Als
@Xaade: I wonder if they have access to your privates then :P
 
"internal representation of an object is generally hidden from view outside of the object's definition"
It's even in the quote you quote.
If you expose internal representation in any way, you break encapsulation.
 
Als
oh Cat wisdom..
 
Xeo
@CatPlusPlus Sounds like a good time for @sbi's quasi-class paper
 
Guess what "internal representation" means.
 
Als
7:01 PM
@bamboon: Who told you new and delete can take any number of arguments?
 
@bamboon Because that would be a bit too insane for C++, don't you think?
@Als Er, they can. It's called placement new.
 
@jisaak You know. All the keywords in the world, are simply for other programmer's benefit. Creating getter and setters that simply get and set without restriction, is no different from making public. So while the data is still "hidden" by theoretical definition, it's not hidden by practical definition. Worse yet, you likely exposed the implementation by doing the get/set inline in the header file.
 
@bamboon Why would they?
 
It would be insane yeah, but c++ is insane, isn't it?
 
I mean, what information do you want to attach to operator+?
 
7:02 PM
just some crazy thoughts
 
@bamboon Well, there are limits. This is not Perl.
 
Als
@RMartinhoFernandes: placement new fine....errr delete?
 
Xeo
Omg, I just got my second sharing badge. I thought they were staged, as in, you can only get per question you link? 1st link: bronze, 2nd link: silver, 3rd link: gold. Seems they changed that.
 
The whole point of a language restricting syntax (in the case of public/private and such) is for programmer benefit. If you skirt around it technically, you still broke it ideologically, and if you can't see that breaking it ideologically is in fact breaking it.... is evidence of a poorer ability to design.
 
@Als All placement new forms should (maybe must, not sure) have a matching delete form.
@Xeo There's a gold one?
 
Xeo
7:04 PM
1000 unique IPs, Publicist
 
C++ model of encapsulation is pretty bad as it is, no need for getters/setters.
 
Oh, I only have Booster (silver).
 
Also, keeping ABI stable in C++ is so hard.
Did you notice that?
 
Xeo
Right, I got that one just now. And I got the bronze one earlier this week, from the same link.
 
7:05 PM
I think the internal representation is still not visible if you provide getter / setter because the the class owner can still change the member, store it in a list or anything else
 
Als
Oh fuck I need around 90 upvotes for c gold shiny!
 
I can feel ....
 
Als
Anyone has that one?
 
Right, because struct foo { int get_x() const; void set_x(int); private: int x; }; doesn't expose int x; in any way.
 
Let me give you ten ...
 
7:06 PM
@CatPlusPlus Of course not, it's private!
 
@jisaak You missed my point. While technically hidden, that's not the intent of the term "hidden". The intent of the term hidden is to hide DATA from USE. Meaning that not only are you able to change implementation, you're able to change data structure.
The term "hidden" is a catch-phrase designed to help programmers design better. A plain getter/setter is not designing better.
 
I use getters and setters in C# because they come for free, are usable in interfaces, and make the ABI stable, not because they hide anything. If I want to hide something, I don't expose it. Simple.
 
We need modules and strict interface/implementation separation.
 
If I could only get rep for correcting misconceptions (instead of just answering questions).
 
(Dunno if related, just a thought.)
 
7:08 PM
so you want to tell me is if i provide access to a member of a class because it needs to get changed from outside, i broke the rule of encapsulation?
 
Ask yourself why it needs to be changed from outside.
 
Als
@Xaade: And creating few on non-c++ thingys then you would be ritchie rich
 
@Xaade If only I could be bothered to spend my time answering questions
 
@jisaak In an ideal OOP, yes.
 
Als
ideal OOP uhm
 
7:09 PM
I never learned any OOP theory, mind you, that's my common cat sense.
 
In an ideal OOP, data wouldn't matter. All objects would be manipulated by their interface. And the concept of "simple flags" would not exist.
 
OOP in Portuguese is spelled POO.
 
I wouldn't provide a setter if I don't need it
 
Als
Cat Wisdom son @CatPlusPlus
 
You think you need it. The question is why.
Why, why, why, like an annoying child.
Wait, that's the only kind of child.
Anyway.
 
7:11 PM
My cousins are not annoying.
 
Because they're somewhere else?
Yeah, I guess that works.
 
If you're manipulating data either your interface is not sufficient, your class is carrying too much responsibility, or both.
 
No, because they're awesome.
But sadly, yeah, they're somewhere else :(
 
Oh, right, they must be robots, too.
Silly me.
 
morning
 
Als
7:12 PM
pups here @DeadMG
 
You were here, like, 20 minutes ago.
 
Als
we can expect some real man words now :P
 
@CatPlusPlus IOW, satellites.
 
true
but then I was un-here
 
And it's suddenly morning? I sense a temporal distortion.
 
7:13 PM
I sense your mother
oh wait, that's because she's so fat, there's nowhere she isn't
 
yes xaade, you are right.
 
And earthquakes.
 
Als
@DeadMG: here he goes..
 
Well, yours was so fat she collapsed into black hole.
 
@CatPlusPlus Our brains cannot perceive time as enlightened. We are simple 3d beings.
 
7:14 PM
lol
your momma's so fat she sat on a black hole and crushed it
 
Als
whats it with the momma jokes?
 
@jisaak Then don't use that class, modify it, or derive from it and stop using private so much. Use protected when you can imagine any possible future child needing it. I only use private when I want to seal the data from inheritance.
 
it's a competition to use the highest science to produce the lowest form of humour
 
Your momma's so fat she's in two universes at once.
 
Als
It's kind of weird...disturbing
 
7:16 PM
@DeadMG Your momma's so fat, she became a black hole from having too much mass
 
your brain is so small, the Heisenberg Uncertainty Principle applies
 
Guys, it's "yo momma".
 
@Xaade CatPlusPlus just said that one
 
yes, I tend to use private to much and provide getter / setters to fast
 
@CatPlusPlus Your momma's so fat, her fat spreads through time because it ran out of space.
 
7:18 PM
Lol.
She's beyond 3D.
 
Yo momma so fat, the Big Bang was her popping a zit.
 
Oh, hey I was looking for this.
shakes paw
 
Yo momma is the reason why the universe keeps expanding.
 
@CatPlusPlus FORMAT STRINGS BAD!
 
7:20 PM
What format strings?
 
The ones from Python.
The % operator.
 
("void %s();" % fn)
 
Oh, those. I prefer format.
'void {0}();'.format(fn)!
 
format number? not really a great improvement
 
Als
why the fuck are you guys always discussing python and Haskel in the C++ Lounge?
 
7:22 PM
what's wrong with just "void " + fn + "();"?
 
Does Python have embedded stuffs in strings, like "void ${fn}()", or is it Ruby?
 
@DeadMG It's ugly.
 
@Als Because we all know C++ so well, it's not worth discussing.
 
The number is position of the argument.
 
Als
@RMartinhoFernandes: I don't.
 
7:23 PM
@RMartinhoFernandes Ruby.
 
@DeadMG That's not easy to localize! You never know when you want to localize code.
 
@CatPlusPlus Better than format strings or format numbers
 
Er, no.
 
Like, change void to vazio or something.
 
@RMartinhoFernandes Then call localize_filename(fn) to get the localized string
 
7:23 PM
@Alf P. Steinbach: sorry for the late answer but, yes, I think this this genuine realization of mine. The earliest article I could find on this is in comp.lang.c++.moderated
 
Concatenation only works for small templates, and when you want no, well, formatting.
 
@DeadMG While I was totally joking, that's not a solution. Some languages change the order of stuffs.
 
And it's not idiomatic Python code.
 
@RMartinhoFernandes I know that I have seen localization as a real argument against plain concatenation
but IMO, it's a bad one
 
Also: repeating, formatting, complex, multi-line templates
 
7:25 PM
@DeadMG Why?
(Talking of real localizable stuff, not "void %s()" obviously.)
 
@RMartinhoFernandes Because any function you call which can change the order of items in a format string can also change the order of items in a concatenation call.
 
And how do you want to store concatenation call in locale files?
 
@DeadMG Usually localization is done by translators, not programmers, and doesn't require any code changes. How do you propose to make that work?
 
if you want to do it without code changes then just define it in some script or XML
 
Yeah, right. XML.
 
7:29 PM
Right, that's really scalable solution you've got there.
 
meh
it's just a quick example
I personally would write it in a script language like Lua, perhaps
 
There's a reason nobody does that.
 
well, what are you going to do with format strings that's different instead?
 
One is that gettext is de facto standard for this sort of stuff, and gettext is a mapper from string to string.
 
@DeadMG You extract the format strings into a table, and the translators provide different tables.
 
7:30 PM
Two is that translators don't want to write code, they want to translate strings.
 
No code whatsoever, just text.
 
Again this post build issue
 
@RMartinhoFernandes Right. Because it would be so difficult to write a trivial tool which would do the conversion for you at development time?
 
Where is that located, I can't find it in properties?
 
7:32 PM
there's hardly a big difference between "Write %i where you want to insert the number of files" and "Write << filenum where you want to insert the number of files"
 
There is.
With the first one, the translators see a single string.
 
and concatenation is more flexible anyway- what are you going to do, printf(gettext(lang, usage), args)?
 
/ALLOWISOLATION /MANIFESTUAC:"level='asInvoker' what does this do?
 
Yes, that's what you usually do.
 
that's never going to work if the arguments you're re-ordering have different types
 
7:33 PM
What?
 
you can't exchange "%s %i" for "%i %s", because now your arguments are in the wrong order
 
Because you don't do that.
 
You can give numbers to printf format specifiers.
 
You change "{0} {1}" to "{1} {0}". The order in the code or types don't change.
It's only position in the text.
Really, we've done localised software, we kinda know what we're talking about.
 
which is exactly the same as concatenation, and you could write a tool of your choice to perform a conversion
 
7:35 PM
Well, I did, at least.
 
@rubenvb xD
 
Good lord, again with the pointless performance rants.
 
@DeadMG No, with concatenation you have to change the code to concatenate in a different order.
Ah, C printf is not usable. It's POSIX printf that supports %1$s.
 
Boost.Format!
%0% %1%!
 
Is there an active web room?
 
7:36 PM
@RMartinhoFernandes Only if you hard-code the order. You could load it as a bunch of std::function<std::string(int, int, int)> from a DLL or something.
or even from a script
 
Right, now we promote translation files to platform-specific DLLs.
Again, translators don't want to write code.
 
if they can handle {1} and {0}, then they can handle + arg1 + and + arg0 +
 
And why do I still bother.
 
sbi
@Xeo It isn't my paper, you know.
@CatPlusPlus But being bored is painful.
 
@DeadMG I don't see how that makes anything easier.
 
user142019
7:43 PM
Hi.
 
@WTP Hi
 
@RMartinhoFernandes Nor do I see how format strings makes anything easier.
if you want to implement translation as "Load from a file", then the same approach can apply just fine to concatenation.
it's just a different kind of file
 
http://en.wikipedia.org/wiki/WTP
My favourite one is "Slang term for "what the penis", after the style of "WTF""
 
user142019
WTP means "what's the point" in my name, a quote from the Dudesons. The '-- is just decoration.
 
@DeadMG A file that requires more knowledge to write than knowledge of the languages involved.
 
7:45 PM
so? get one of your devs to write a tool to generate it. problem solved.
 
@rubenvb wait my solution has a bug :(
 
@WTP Ahh
 
But why write that extra code when you can do the same much easier if you just get over your fear of format strings?
 
because format strings are buggy and unsafe?
 
Because performance and whatnot!
Format strings aren't buggy and unsafe. printf is buggy and unsafe.
 
7:48 PM
@DeadMG You're blinded by your experience with printf.
 
There's a difference.
 
Also, GCC warns on printf misuse.
 
Xeo
@sbi I know, but you always link to it :)
 
@RMartinhoFernandes Great. A warning. I'd rather use a library which doesn't need any kind of warning.
 
sbi
@Xeo You always post about SFINAE — and it's still not yours. :)
 
7:49 PM
Then... use one?
Boost.Format is type-safe.
 
And extensible.
 
never had a need to use it
 
Totally unlike printf.
 
Xeo
@CatPlusPlus But hella-slow
Even slower than streams
 
Didn't notice.
 
7:50 PM
I have a somewhat unrelated question
 
But then again, I seem to be one of the few people here who aren't religiously squeezing every cycle out of the CPUs.
 
why didn't the Standard adopt expression templates to optimize string concatenation, stream insertion, etc?
 
@Xeo How can it be slower than streams? Boost.Format doesn't do output.
Oranges, apples...
 
Xeo
@RMartinhoFernandes I mean conversion with stringstreams, aka formatting
 
String formatting is supposed to be slow, AFAIK.
 
Xeo
7:51 PM
Err
 
wait a minute
how come this web hosting provider wants to charge me and then claims I have no active subscriptions?
 
You were robbed?
 
that's not logick
 
@Xeo Oh well, that's sad :(
But I still see no inherent reason format strings are bad.
 
7:55 PM
time to find another provider... again
 
Xeo
@RMartinhoFernandes They aren't. I never said that, or did I?
 
I wasn't targetting anyone, just spewing that out.
 
hey
my question got closed!
 
Xeo
lol
That was fast
2.5 min
 
there are plenty of questions about the history of C++'s Standardization
what's different about mine?
 
7:57 PM
@DeadMG What was the question?
 
none of them even fucking commented
 
Xeo
You didn't have the !
 
0
Q: Why didn't the C++ Standard adopt expression templates?

DeadMGIt's my understanding that expression templates as a technique were discovered significantly prior to the original C++ Standard in 1998. Why weren't they used to improve the performance of several Standard classes like std::string and streams?

 
Help! I can't stop optimizing my code even though it doesn't work :(
 
Kawoosh, really fast.
 
@MooingDuck A wise man once said "It's easy to write a fast program that outputs garbage."
 
@RMartinhoFernandes You mean "whoosh".
 
Xeo
@CatPlusPlus I have the cape, I make the fuckign "whoosh" noise!
 
Yeah, I would have closed that as well.
 
Points for anyone that gets the reference.
 
7:58 PM
@EtiennedeMartel Why? There are lots of similar questions which are open.
 
@DeadMG Show them to me and I'll close them as well.
 
@RMartinhoFernandes axiom1: All code can be optimized. axiom2: All code has at least one bug. conclusion: All code can be optimized to one instruction that doesn't work.
 
Your argument is like saying "Why can't I steal? There are plenty of thieves around!"
 

« first day (466 days earlier)      last day (4482 days later) »