« first day (571 days earlier)      last day (4378 days later) » 

2:00 AM
@Maxpm oh, sure. it was all really elegant and clever and amazing and he was super-smart and we all know that makes great code right?
 
Xeo
Where an intermediate base class has no or few members really, just so that I can stuff everything of that category in a vector
 
@stdOrgnlDave Inheritance for code reuse alone is obviously a bad idea. Maybe it's just because I'm a student and I've never seen real-world code, but I have a hard time believing that the vast majority of inheritance usage is like that.
@Xeo I don't see anything wrong with that. Why is that abuse?
 
@Maxpm the vast majority of code is broken in more fundamental or subtle ways than "there's too much inheritance" or "there's too little inheritance"
 
So inheritance is bad and outdated because people misunderstand it?
 
@Xeo I do that too, except sparingly
 
2:02 AM
Like a more modern goto?
 
that's like saying templates are bad and outdated because people misunderstand them
 
user406009
@Xeo What do you do with these intermediate classes then? It seems like you lost almost all the useful type information.
 
@EthanSteinberg He could still use polymorphism, no?
 
@EthanSteinberg you provide a virtual function that returns an enumeration of the type, then dynamic_cast to that derived type, DUH
 
Xeo
No dynamic_casts were harmed in the production of my classes. :P
 
2:04 AM
Hi all!
 
hey....can constexpr be virtual? :-\
 
What does this mean ?
void putAll(Map<? extends K, ? extends V> m);
 
user406009
@Maxpm "has no or few members really"
 
@SerenityStackHolder That's definitely Java.
 
2:04 AM
That's also definitely part of the collection framework.
 
Of course!
 
Which I said sucked a few minutes ago.
 
@SerenityStackHolder if you REALLY want to troll in here, ask C++ questions. you're just annoying now, but you'll get us upset then.
 
I don't understand, I am not a troll, I just want to know what does that method do
 
It means that it takes a map where the key type is any class that extends K, and the value type is any class that extends V.
 
2:06 AM
go to the java chat
 
and since there is no active Java community and feel too stupid to ask on SO
I came up here. :)
 
ever heard of IRC?
 
Tried, no one there also.
 
Let's not be nasty, now.
 
Thank you Maxpm!
 
2:07 AM
@SerenityStackHolder Without knowing the context, I'm guessing that it adds all the elements of m to the object.
 
user406009
@SerenityStackHolder I have never seen that syntax, but it is my guess that it is telling you that you can pass in any map where the elements can be derived from the key and value of the current map.
 
But if you need a concrete answer, you should check the official documentation.
 
so it maps two classes, one of which extends k and the other extends v and stores them to m?
 
how can there be "noone there" on IRC?
 
@SerenityStackHolder Well, m is a parameter. So it's not storing anything to it.
 
Xeo
2:08 AM
@EthanSteinberg I shouldn't have said "no member". Normally, there's one virtual method.
 
It's accepting a map of two classes, one of which extends K and the other extends V.
 
Maxpm, this is what official documentation say ideone.com/Y3QSM
 
Xeo
@Maxpm Dunno, it kinda feels like abuse to do that
 
@Maxpm you have that backwards, it's mapping the exception of the two classes
 
Xeo
Anyways, imma head off to sleep now
g'night
 
2:09 AM
funny thing is that I can't find body of this method
 
@xeo byeeee
 
night, xeo
 
@SerenityStackHolder I imagine not.
It's part of the Java standard library.
 
oh, I will be back in a bit, I can't dirty my eyes with this Java crap
 
Usually, standard libraries just provide method signatures and descriptions of what they do.
 
2:10 AM
I see, but how do they handle processing then?
 
@SerenityStackHolder I'm not familiar with the specifics of the Java ABI, but I imagine it's all included in a .jar file as compiled bytecode.
So the implementation exists. It's just that the documentation doesn't bother showing it, because it's not really relevant.
If I see a new method, I probably want to know what it does before knowing how it works.
 
Thanks Maxpm. I should now post a Q about how to retrieve the body of the methods from the bytecode. :D
 
@SerenityStackHolder Well, you can't.
Probably not, anyway.
 
user406009
 
The Java compiler is taking the source code -- the body of the method -- and translating it into very basic instructions that the runtime understands.
 
user406009
2:13 AM
Have tons of fun.
 
There are ways of getting the meaning of each of these instructions, but you will not be able to get the source code that compiled to them.
 
Wow! :D Thanks, Ethan!
 
user406009
Hah, surprisingly boring "core" implementation.

for (Map.Entry<? extends K, ? extends V> e : m.entrySet())
put(e.getKey(), e.getValue());
 
Anyway, back to that K and V business.
Let's say I have a Map of Humans and Vehicles.
Human is K; Vehicle is V.
Before adding another map to this one, I need to make sure that it's also a map of Humans and Vehicles.
 
2:16 AM
? extends K is saying "I want the keys to be anything that might be considered humans."
? extends V is saying "I want the values to be anything that might be considered vehicles."
That way, you can add a map of Humans and Trucks.
 
are we actually discussing Java here
 
Yes.
 
you realize almost the whole chatroom has gone idle since you guys started doing that
 
Very nice explained Maxpm!
 
java is toxic
 
2:18 AM
@stdOrgnlDave Yes, it is, but we're no more off-topic than we usually are.
@SerenityStackHolder *Takes a bow*
 
We're preparing pitchforks.
What.
 
Aw, (removed).
Now I'll never know.
 
@CatPlusPlus What about torches?
 
I said that C++ is better than Java, Maxpm! :)
 
Apt.
 
2:21 AM
and CPP replied with What? He may be right, so I deleted it.
 
@Xeo You never answered: why is stuffing child class objects into a vector of parent class objects "abuse?"
 
Lemme use a magic trick.
 
Xeo
13 mins ago, by Xeo
@Maxpm Dunno, it kinda feels like abuse to do that
 
3 mins ago, by Serenity Stack Holder
std, java is precedent to C++, so have a little respect, please
Behold. Necromancy.
 
@Xeo My mistake. Also, so much for going to bed!
 
Xeo
2:23 AM
And it's not about the vector, just about the inheritence to add a little function to aid categorization
@Maxpm regulars here know that I always not go to bed the first time I says so :P
@CatPlusPlus lol
If you have the id, you have the message
I'm sure that counts as a bug
 
The whole point of inheritance is to aid categorization, is it not? (Proper) inheritance is grouping different types of "things" with respect to how they function. Or so I thought.
He who controls the IDs controls the universe.
 
user406009
I always thought inheritance was only about overriding functions. All the grouping / reuse of code is just extra gravy.
 
@EthanSteinberg Overriding a function has no meaning unless the alternative is to reuse the default.
Unless I misunderstand you.
 
user406009
Meant it more like polymorphism. Being able to call one function and have it do different things for different objects.
 
Oh.
 
user406009
2:30 AM
But I guess that makes no sense. You don't need inheritance for that. Duck typing works just fine.
 
According to Joshua Bloch, inheritance implies substitutability. Any code that uses Parent should work exactly the same with Child. To determine if a class should be inherited from, ask yourself, "Is every Foo a Bar?" If you can answer that with a straight face, it's a subclass. Otherwise, Foo has nothing to do with Bar from an external perspective.
But that doesn't really tell us anything new.
Actually, it might.
What if the point of inheritance were to say that Foo, an existing class, could be reliably used in place of Bar? The code reuse aspects are ancillary.
I'm satisfied with that explanation.
 
@EthanSteinberg Duck typing and inheritance are quite related. Inheritance is stronger typed, which is quite the plus; but you're right that if you have duck typing, you don't really need inheritance
 
2:46 AM
@DeadMG So I could have an array of cars and append a truck to it, because both classes have a drive() method?
 
@Maxpm In duck typing, there is no such thing as an array of cars. Only an array of "stuff".
 
Gross.
 
If it can drive(), it's a truck.
Or a car. Whatever. That's duck typing.
 
user406009
I guess that finally answers why inheritance can be considered outdated here.
 
user406009
People here love templates, and templates make inheritance almost unnecessary through their automatic duck typing.
 
2:57 AM
@EthanSteinberg I was going to say that it reminded me of C++ templates.
Yeah, I guess that's our answer.
 
yes, exactly
templates offer all the benefits of duck typing, with none of the type insecurity
you don't need an explicit interface, you don't need to inherit, but it's generic anyway
 
There is something to be said for Java generics, though.
Ignoring the way they're implemented, they work like templates except that you can constrain them so that parameters have to extend certain classes.
 
Xeo
Good joke.
 
What?
 
Java generics are as primitive as the rest of it.
 
Xeo
3:07 AM
Generics are just a thin disguise that does some casts, if you will
 
@Xeo Ignoring the way they're implemented.
 
Xeo
But you can't ignore that!
You can't overload based on generics, you can't specialize
 
You can constrain C++ templates, too.
 
Xeo
they're nothing like templates
 
@CatPlusPlus How?
 
3:08 AM
With SFINAE.
 
Xeo
std::is_base_of and std::enable_if
 
And traits.
 
Xeo
or static if, whenever we finally get that
 
Xeo
template<class T, typename std::enable_if<std::is_base_of<your_base, T>::value, int>::type = 0> void foo(T t){...}
(yes, it looks hideous, but it's C++ we're talking about. It gets better with alias templates)
 
3:10 AM
And you can constrain C++ templates based on any predicate, not just inheritance relation.
(Typeclasses are still better.)
 
Typeclasses as in Haskell?
 
Certainly not Java.
 
Typeclasses strike me as Java interfaces.
But I know very little about Haskell.
Oh man, enable_if is really clever.
 
3:27 AM
@Xeo It's possible to use a hard error instead of a soft error here (i.e. rely on SFINAE).
 
Xeo
@LucDanton Shouldn't that be a soft error?
 
If foo is overloaded, then maybe (but that's using SFINAE the usual way, not enforcing requirements). Otherwise you make the error somewhat more obscure, but that depends entirely on the QoI of diagnostics.
 
God, what would the compile error look like when your_base isn't the base of T and there is no "default" template?
 
'No matching overload found in call to foo', or something to that effect.
 
Xeo
traditional SFINAE error I'd think, the function just doesn't exist
 
3:32 AM
Perhaps that's one benefit of the way Java does it: the compiler can give a more useful error message. Though I suppose the benefits of C++ templates far outweigh that.
 
Xeo
If the compiler wanted, it could give out the same amount of info
 
You don't have to use SFINAE for that and you can enhance error messages slightly (but not by much). Is my point.
 
Xeo
See Clang, for example. It even says "info: overload not viable: substitution failure" or similar
And then lists the function
 
main.cpp: In function 'int main()':
main.cpp:17:10: error: no matching function for call to 'foo(int)'
If you use e.g. -Wfatal-errors.
If you don't, then there are follow-ups messages that show what happened when the substitution was attempted.
error: no type named 'type' in 'struct std::enable_if<false, int>'
     , int>::type = 0
                    ^
Doesn't exactly show that that false was obtained from std::is_base_of though.
 
Xeo
Is that with Clang?
 
3:37 AM
No.
An example of using SFINAE and concept checking in tandem.
Not that there is a DerivedFrom concept or anything like that though.
 
unless we are actively bashing it or discussing our superiority over it, Java is off-topic. it's one of a very few, select things that are off-topic here.
 
Xeo
@LucDanton I don't think "DerivedFrom" would fit as a concept, since it's too specific
 
Lounge<C++, std::enable_if<std::is_not_java>::content>
yes that is a bastardization but it still stands
 
@Xeo Indeedy. It makes sense to compose traits on the spot, but you really want to write fully-fledged concepts out of line (and those out-of-line definitions can themselves be written in terms of preexisting concepts and traits, so there's no DRY violation).
 
6 hours ago, by std''OrgnlDave
**background** I've been out of full-time employment for almost 5 years. I skipped college and went right to work, then became disabled, unable to use my hands. my resume is thusly lacking.
**challenge** get a job
 
3:48 AM
Well that sucks.
 
yes. on the other hand I give dazzling interviews
 
Dazzling!
 
I'm considering making some form of project just to show as recent work (since I can;t really throw around stuff I've contracted on)
 
That's a good idea.
 
but I can't decide what form of project
 
3:50 AM
I plan on doing a ton of programming this summer to get a start on a portfolio of sorts.
 
@maxpm what are some good buzzwords to skim on Wikipedia so I can put them on my resume?
my favoritest thing I ever did make, an NES emulator, I lost the source code to :-(
I still have the CPU core only
 
Aw. That sucks.
 
You could always redo it. It'll probably be easier the second time.
 
Xeo
If you're into games
 
3:51 AM
@Xeo Thanks!
 
I'm going to be doing the liberated pixel cup, I believe
 
Also, wow, you really didn't go to bed.
 
I have just a bout the most awesome idea possible, but it's taking a ridiculous amount of software performance
I wish that I could count on decent 2d acceleration from a Completely Free Platform
 
Xeo
@Maxpm Well, I am laying in my bed right now
But I'm playing a game
And I just didn't really feel like sleeping after all
 
but experience teaches us that an intel gma950 can't accelerate a few thousand sprites as well as the intel atom processor that runs it can
@Xeo what game?
 
Xeo
3:52 AM
Hoshizora no Memoria, an Eroge
 
hey maybe I could use a partner in the LPC
 
Xeo
Japanese Visual Novel :P
 
I know what eroge are
 
LOL.
 
it makes me queasy to remember that people type on the same keyboards they do that sort of thing on, when I am at someone's house using their keyboard
 
3:53 AM
Eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeew.
 
Xeo
The fuck?
Who the heck faps onto their keyboard? Seriously?
2
 
@maxpm: describe your experience and projected performance working with a 2D engine
@Xeo they fap while typing at their keyboard/moving their mouse for the pr0n, then they wipe, not wash, and go back to typing
 
@stdOrgnlDave Ha.
 
@maxpm have you ever programmed an emulator for, or a game for, a vintage game console?
have you ever played a real NES? or even a real Sega Genesis? how old are you?
 
I wish. That sounds kind of fun.
Never played an NES or Genesis. I'm 16.
 
3:56 AM
oh. too bad. my awesome shoot-em-up tells the story of an 8-bit hero saving his world from the corruption of 16- and then 32-bit remakes
 
That sounds awesome.
Hey, I could use your opinions on this:
 
of course he has to wield these powers himself...will they corrupt him? will his land, in the end, become 16-bit? or will he preserve his people as they are? can they be improved? should he be the one to improve them? all things to answer while you're in bullet hell inspired by ikaruga and based off of art from the LPC
perhaps if you manage to save enough of the 8-bit world as it is replaced, you can rebuild it somewhere...but you'll have to make sacrifices...
oh, I am so happy to do the LPC
 
user406009
@stdOrgnlDave Just wondering, what were you planning on drawing with thousands of 2d sprites?
 
The only LPC I know is for MUDs.
 
In D, functions can be marked pure for functional programming. pure functions cannot do I/O. I have a library made out of pure functions that forms a string that can be outputted to a terminal (in impure code) to be displayed with fancy colors and effects.
Now, the issue is that it's really easy to misuse the library. Someone could, for instance, save the string to a file.
 
3:59 AM
Terrible.
 

« first day (571 days earlier)      last day (4378 days later) »