|
feedmegin posted:Some of the time, sure, but it's a difference of degree. It's all over the place in gtk because they thought it would be a wizard idea to recreate C++ inheritance and vtbls in plain C, rather than just, y'know, using C++. C++ has order-of-magnitude-longer compilation times and isn't easily bindable to other languages because of name mangling. Qt, the competitive toolkit, requires a custom preprocessor to even make C++ usable for their use case. GTK+'s object system uses checked casts that will give a runtime warning if you cast incorrectly, something C++ doesn't have (unless you use dynamic_cast, at which point you're left with C++'s batshit insane exception model)
|
# ? Apr 24, 2016 19:14 |
|
|
# ? Jun 1, 2024 17:33 |
|
Suspicious Dish posted:GTK+'s object system uses checked casts that will give a runtime warning if you cast incorrectly, something C++ doesn't have (unless you use dynamic_cast, at which point you're left with C++'s batshit insane exception model) Uhh. You don't need to cast at all in C++ as a rule, the language provides virtual functions and inheritance for you, that's the whole point. If you have a Foo * and you try and call a Bar::something on it without Bar being a superclass of Foo the compiler will tell you that at compile time, which is when you want it. Gtk is manually doing stuff that C++ specifically has syntactic sugar (and compile-time checks) for, and doing it worse. My point is, if this is a thing that you want, why not use the language that actually has it built in, kind of thing? As for dynamic_cast, if you are using it, normally you're operating on a pointer. Dynamic casting a pointer doesn't throw an exception on failure, it returns a null pointer. No exceptions required (and indeed Qt doesn't use exceptions at all!).
|
# ? Apr 24, 2016 19:46 |
|
I thought dynamic_cast threw a std::bad_cast if it was incorrect, and all the documentation I've found says this. That said, I can't find any good official C++ documentation. As I said, GTK+ doesn't use C++ because of horrendous compile times and lack of bindability. Also, it was 1996, when C++ support was completely lovely and half-baked everywhere.
|
# ? Apr 24, 2016 20:10 |
Suspicious Dish posted:I thought dynamic_cast threw a std::bad_cast if it was incorrect, and all the documentation I've found says this. That said, I can't find any good official C++ documentation. http://en.cppreference.com/w/cpp/language/dynamic_cast quote:If the cast is successful, dynamic_cast returns a value of type new_type. If the cast fails and new_type is a pointer type, it returns a null pointer of that type. If the cast fails and new_type is a reference type, it throws an exception that matches a handler of type std::bad_cast.
|
|
# ? Apr 24, 2016 20:12 |
|
Suspicious Dish posted:As I said, GTK+ doesn't use C++ because of horrendous compile times and lack of bindability. Also, it was 1996, when C++ support was completely lovely and half-baked everywhere. Qt supported about a zillion different platforms/compilers back then and indeed still does (this is one of the reasons it has its own collection types and doesn't use exceptions, actually). Nor are compile times as bad as you're making out. Bindability, sure, I guess I can kind of get behind that though bindings to Python do exist for Qt. But that, uh, doesn't really apply to the giant mound of software written in C using gtk!
|
# ? Apr 24, 2016 21:13 |
|
Aha, I missed the pointer vs. reference distinction. feedmegin posted:Qt supported about a zillion different platforms/compilers back then and indeed still does (this is one of the reasons it has its own collection types and doesn't use exceptions, actually). Nor are compile times as bad as you're making out. I work on C++ projects all the time. They consistently take 5 or so times longer to compile than the corresponding C program. I don't like working on C++ projects. And yes, Qt works around the platform issues by not using basically anything from the C++ standard library and opting to use their own, including their own object system using moc. Qt effectively has its own standard library inside of it. feedmegin posted:Bindability, sure, I guess I can kind of get behind that though bindings to Python do exist for Qt. But that, uh, doesn't really apply to the giant mound of software written in C using gtk! Why doesn't it apply? You can introspect and bind against any library written in C super duper easily from a large number of runtimes including Python, JavaScript and Lua. That said, I don't see why "casts, casts everywhere" is particularly bad if the casts are minimal and checked. Engineering is full of trade-offs. I don't necessarily think all of C is great, but I understand why things were done the way they were, and I don't have a particularly great appetite for full C++.
|
# ? Apr 24, 2016 21:36 |
|
pokeyman posted:"I don't know what I'm talking about. Here is an obviously stupid generalization." I'm not a chef, but I can tell when something tastes like dogshit.
|
# ? Apr 25, 2016 02:53 |
|
Suspicious Dish posted:Why doesn't it apply? You can introspect and bind against any library written in C super duper easily from a large number of runtimes including Python, JavaScript and Lua. If you are writing a program in C, you don't care about interoperability in languages that are not C. Because you're writing it in C.
|
# ? Apr 25, 2016 09:54 |
|
feedmegin posted:If you are writing a program in C, you don't care about interoperability in languages that are not C. Because you're writing it in C. But if, as in the post you quoted, you're writing a library, you might well write it in C specifically so that it can be easily bound to other languages. (Though you can also write the bulk in C++ with an extern "C" API exposed.)
|
# ? Apr 25, 2016 12:05 |
|
I'm using a javascript tool that grabs a bunch of streams of data, douses them in callback soup, then inflates a visualization. I'm trying to point it at a local CSV instead and the stupid parts of it are difficult. My favorite bit is the canonical (as in other questions are marked duplicate and rerouted) "how do I parse CSV in JS" SO question is ultra-specific to single-quoted strings, so much so that it's outside of the RFC and Excel implementations and won't help anyone who just wants to do that.
|
# ? Apr 25, 2016 17:33 |
|
https://github.com/ansible/ansible/blob/devel/lib/ansible/template/__init__.py#L331-L335 The future of DevOps. (This is causing us an issue in production right now where Ansible wants to replace all double quotes with single quotes causing output to be invalid JSON)
|
# ? Apr 25, 2016 20:42 |
|
The very existence of a method named "safe_eval" fills me with deep unease.
|
# ? Apr 25, 2016 20:50 |
|
Any time I encounter a solution that involves eval or exec I close the tab. Never really seen a situation where using it wasn't a cheap hack filled with future regret or risking a gaping security hole.
|
# ? Apr 26, 2016 00:23 |
|
Whoever said earlier that a WordPress plugin wants .htaccess to be writeable by the server is incorrect. It is, in fact, WordPress itself which tries to get that capability. All so delicate little flowers don't have to copy and paste generated code into a text file. I don't really want to know what horrors lay even deeper down, that I haven't seen At least I'm getting to the point where I think I understand the way the designers think. It's a horrible way to think and I disapprove of it, but it means that if you're wondering how to do something, you just have to consider how an utter moron would've expected you to do something (often involving a database structure that is an affront to the LORD our God) and, voila, you've done it the Proper WordPress Way.
|
# ? Apr 26, 2016 03:35 |
|
TooMuchAbstraction posted:The very existence of a method named "safe_eval" fills me with deep unease. I found a function used in our code called "easyrpc" which wraps an rpc call to the serve in a way that's really easy to pass arguments into. Unfortunately, it also handles all errors returned by the rpc internally by swallowing them, and this isn't documented at all despite having an "error" outparam that is never populated. Which has led to a lot of areas in our client that just crash and burn if whatever code is being called on the server stops working for whatever reason. Any time a function is named "easy*" or "safe*", it's a good shorthand for "this developer did not think hard enough about what they were doing".
|
# ? Apr 26, 2016 19:19 |
|
Or they lump more and more logic/parameters until it's as complex (and less documented) than the original thing they were trying to simplify.
|
# ? Apr 26, 2016 19:26 |
|
LeftistMuslimObama posted:I found a function ... which [performs] an rpc call ... [w]hich has led to a lot of areas in our client that just crash and burn if whatever code is being called on the server stops working for whatever reason. Omit needless words!
|
# ? Apr 26, 2016 21:39 |
|
rjmccall posted:Omit needless words! and then you left in anything beyond "I found [...] an rpc call"
|
# ? Apr 26, 2016 21:47 |
|
rjmccall posted:Omit needless words!
|
# ? Apr 26, 2016 22:09 |
|
All that talk of RPC reminded me of this disasterpiece: http://www.omg.org/news/meetings/workshops/RT_2003_Manual/Tutorials/T2_SCA_Hayes.pdf
|
# ? Apr 27, 2016 04:10 |
|
LeftistMuslimObama posted:I found [...] an rpc call to [...] burn
|
# ? Apr 27, 2016 04:14 |
|
Suspicious Dish posted:C++ has order-of-magnitude-longer compilation times and isn't easily bindable to other languages because of name mangling. Qt, the competitive toolkit, requires a custom preprocessor to even make C++ usable for their use case. Also, C++ is really, really lovely for creating libraries that need to be separately compiled, if you also want clients of the library to derive from the interface classes. This was one of the main problems with the BeOS API (which was very nice otherwise), "solved" by stuffing the interfaces full of dummy member variables and virtual functions.
|
# ? Apr 27, 2016 05:46 |
|
Zopotantor posted:Also, C++ is really, really lovely for creating libraries that need to be separately compiled, if you also want clients of the library to derive from the interface classes. This was one of the main problems with the BeOS API (which was very nice otherwise), "solved" by stuffing the interfaces full of dummy member variables and virtual functions. I thought the standards committee was actually looking at fixing this by providing a standards-compliant way of exporting certain types/interfaces?
|
# ? Apr 27, 2016 06:39 |
|
Ender.uNF posted:I thought the standards committee was actually looking at fixing this yeah, c++42 is gonna be great
|
# ? Apr 27, 2016 09:24 |
|
JawnV6 posted:I'm using a javascript tool that grabs a bunch of streams of data, douses them in callback soup, then inflates a visualization. I'm trying to point it at a local CSV instead and the stupid parts of it are difficult. I love the stupid bureaucracy of Stack Overflow where they have an impoverished set of reasons for closing a question so if they want to close some question for a reason that's not in the pre-approved list of radio buttons, they just choose some random reason like "not clear what you're asking" even if it obviously doesn't apply.
|
# ? Apr 27, 2016 12:39 |
|
Hammerite posted:I love the stupid bureaucracy of Stack Overflow where they have an impoverished set of reasons for closing a question so if they want to close some question for a reason that's not in the pre-approved list of radio buttons, they just choose some random reason like "not clear what you're asking" even if it obviously doesn't apply. There's an "other reason" where you can fill in your own.
|
# ? Apr 27, 2016 15:21 |
|
Soricidus posted:and then you left in anything beyond "I found [...] an rpc call" sadly, it's the only way to get vb6 to talk to caché.
|
# ? Apr 27, 2016 15:37 |
|
Ender.uNF posted:I thought the standards committee was actually looking at fixing this by providing a standards-compliant way of exporting certain types/interfaces? The "fix" will end up being an LTO IR unique to every compiler, instead of generating the class and vtable layout at runtime.
|
# ? Apr 27, 2016 17:21 |
|
C++ is a mess
|
# ? Apr 27, 2016 18:15 |
|
C++ is actually good
|
# ? Apr 27, 2016 18:32 |
|
Zopotantor posted:Also, C++ is really, really lovely for creating libraries that need to be separately compiled, if you also want clients of the library to derive from the interface classes. This was one of the main problems with the BeOS API (which was very nice otherwise), "solved" by stuffing the interfaces full of dummy member variables and virtual functions. Qt is pretty good about binary compatibility within each major version, actually, though it does take some effort internally. I assume that's what you're talking about, anyway, since the article you linked is instead about semantic changes in a base class and you're going to have that problem in any language with inheritance - the example on there is in Java, after all - and indeed in gtk/gnome since that has its own virtual method system.
|
# ? Apr 27, 2016 18:34 |
|
feedmegin posted:Qt is pretty good about binary compatibility within each major version, actually, though it does take some effort internally. I assume that's what you're talking about, anyway, since the article you linked is instead about semantic changes in a base class and you're going to have that problem in any language with inheritance - the example on there is in Java, after all - and indeed in gtk/gnome since that has its own virtual method system. Inheritance was a mistake.
|
# ? Apr 27, 2016 18:45 |
|
Absurd Alhazred posted:Inheritance was a mistake. Excuse me but without Cat extends Animal how can you teach freshmen about computers
|
# ? Apr 27, 2016 19:03 |
|
Notorious QIG posted:Excuse me but without Cat extends Animal how can you teach freshmen about computers From what I hear you pretty much assume they already had exposure to programming of some sort already and if they didn't they slam into a learning cliff Wile E. Coyote style and burn out.
|
# ? Apr 27, 2016 19:20 |
|
Ithaqua posted:There's an "other reason" where you can fill in your own. I just checked and I don't see that option as a top-level thing, although there is an "other" option hidden under "off topic". Anyway I've seen questions get closed with erroneous reasons cited plenty of times on there.
|
# ? Apr 27, 2016 20:36 |
|
Notorious QIG posted:Excuse me but without Cat extends Animal how can you teach freshmen about computers I will have you know that cat implements animal.
|
# ? Apr 27, 2016 21:29 |
|
Absurd Alhazred posted:I will have you know that cat implements animal. Well I mean I mainly code in C++ so actually class Cat : public Animal, but point taken.
|
# ? Apr 27, 2016 21:36 |
|
Nearly every place I've seen inheritance used what the developer really wanted was an interface. And there's no excuse for not using them. Even VB6 has interfaces ffs.
|
# ? Apr 27, 2016 21:46 |
|
Notorious QIG posted:Excuse me but without Cat extends Animal how can you teach freshmen about computers I had a teacher talk about design patterns, and he started with something like: Java code:
Then he started talking about "but what if we need to implement a new way of flying", and started changing the code to Java code:
|
# ? Apr 27, 2016 21:55 |
|
|
# ? Jun 1, 2024 17:33 |
|
Absurd Alhazred posted:I will have you know that cat implements animal. In Inform 7: pre:Cat is a kind of Animal.
|
# ? Apr 27, 2016 21:59 |