THE BAD IDEAS THREAD
-
@tsaukpaetra said in THE BAD IDEAS THREAD:
@mott555 said in THE BAD IDEAS THREAD:
the common convention that "save" saves to your existing file is too radical for the GIMP devs.
Ha.
Repro steps:
- Crash a program.
- Let Visual Studio launch itself to try to debug it.
- Visual Studio says it can't without symbols, so close it.
- What are you saving? Well, the solution of course!
- What solution? Oh, didn't you know? We created a fake one since you're debugging something. Because raisins.
- ....
- Profit?
The one that gets me lately is when there's a run-time error which somehow doesn't trigger the debugger WHEN I'M RUNNING THE APPLICATION THROUGH THE DEBUGGER. It gives me some kind of abort/ignore/retry dialog where break does nothing, abort kills everything, and retry actually means "Attach The Debugger Which I Thought Was Already Attached But Apparently Wasn't" which then dumps me into the disassembly for one of my source files with the error that there is no source for the current disassembly.
I hate computers.
-
@mott555 said in THE BAD IDEAS THREAD:
the common convention that "save" saves to your existing file is too radical for the GIMP devs.
It used to save as whatever type the extension indicated, but quite a few years ago they decided that "save" is only for it's native format, and any other format is an "export," although the operation to overwrite an imported file replaces the normal "export" menu item if you've opened a non-native file, but for some inexplicable reason, the keyboard shortcut is disabled. I don't know why the devs thought that was a good idea. I generally like GIMP, but that "feature" is still annoying even after years of being accustomed to it.
-
@mott555 That is completely standard.
-
@hardwaregeek said in THE BAD IDEAS THREAD:
@mott555 said in THE BAD IDEAS THREAD:
the common convention that "save" saves to your existing file is too radical for the GIMP devs.
It used to save as whatever type the extension indicated, but quite a few years ago they decided that "save" is only for it's native format, and any other format is an "export," although the operation to overwrite an imported file replaces the normal "export" menu item if you've opened a non-native file, but for some inexplicable reason, the keyboard shortcut is disabled. I don't know why the devs thought that was a good idea. I generally like GIMP, but that "feature" is still annoying even after years of being accustomed to it.
I think Audacity does something quite similar, except the disabling Save Shortcut thing...
-
A facebook friend commented, "What the crystal meth is going on here?"
-
@hardwaregeek said in THE BAD IDEAS THREAD:
I don't know why the devs thought that was a good idea.
This could probably be the official slogan for GIMP.
-
@mott555 said in THE BAD IDEAS THREAD:
I tried to use GIMP yesterday to quickly crop an image on a Linux system. It wouldn't let me save the JPEG image as a JPEG. Eventually I found out you have to use "export" for that, not "save", because the common convention that "save" saves to your existing file is too radical for the GIMP devs.
The issue is that the standard formats don't contain extended information about things like layers; saving and reloading would have lost all that stuff and that means that you couldn't easily set the file aside for a while (e.g., because you're rebooting the system). It'd be really spectacularly annoying. (You could in theory use application-specific extension metadata in the formats that support such things to store it. But that's pretty awful.) So, much as many other applications do, they default to using their own. Exporting doesn't have the same general expectations of preserving everything, so it's OK that it loses all that info.
IOW, not a WTF at all.
-
@dkf I could imagine popping up a dialog asking what you want to do when selecting save, rather than redirecting to save as or, worse, assuming a filename.
-
Going (very reluctantly) back to Android after Windows Phone. Fuck, it's awful :(
-
-
@anotherusername blackface isn't racist if it's one of those weird things where you pour a gallon of glue onto your face and then painfully tear your entire face off
-
@ben_lubar said in THE BAD IDEAS THREAD:
@anotherusername blackface isn't racist if it's one of those weird things where you pour a gallon of glue onto your face and then painfully tear your entire face off
I really want to do this now!
-
-
@tsaukpaetra said in THE BAD IDEAS THREAD:
I really want to do this now!
Confession: I bought a biore strip because I saw the commercial where the lady pulled it off and there were like all these little snot stalactites on it, and I thought that was cool.
Turns out you do get snot stalactites and it is kind of cool.
-
@anonymous234 said in THE BAD IDEAS THREAD:
I use a program that does that. Before I realized it, I wondered why it got ... um ... interesting results when I sometimes started working on something else while it generated a report in the background.
-
-
@tsaukpaetra said in THE BAD IDEAS THREAD:
@anonymous234 said in THE BAD IDEAS THREAD:
Like Microsoft Terminal Services client?
Relevant:
https://what.thedailywtf.com/topic/3209/using-clipboard-for-application-communication
Memories...
-
-
Bobcats grow to more than twice the size of housecats, though—adults can weigh as much as 40 pounds—and eat a diet that includes house cat-sized cats (usually feral ones).
"cat-sized cats"
No way I'm buying hyphens have lower precedence than spaces.
-
@boomzilla At least apparrently the kittens didn't carry rabies.
-
@boomzilla Just because someone mails you a bobcat doesn't mean you have to keep it.
-
@coderpatsy said in THE BAD IDEAS THREAD:
@boomzilla Just because someone mails you a bobcat doesn't mean you have to keep it.
Reminds me of this photo of Rosie O'Donnell
-
Reading old WTDWTF threads, I saw this post:
@nprz said in C vs C++, from the author of ZeroMQ:
Ok, yeah, for sure there are places where returning a value to indicate success/failure is a lot more convenient (and sensible) than throwing an exception.
You mean you don't do (omitted most things):
// This could return a bool if this were C, but we only have exceptions in C++ void Exists(int num) { if (inmap.find(num) == inmap.end()) { throw DoesNotExist(); } throw NumberExists(); } int main() { try { Exists(42); } catch(DoesNotExist) { cout << "Sorry, doesn't exist."; } catch (NumberExists) { cout << "Found it"; } }
This inspired me to create: a C++ variant, with most control statements other than exceptions removed.
In particular:
- The only loop allowed is
while(true){}
, which could be renamed justloop{}
if you wanted. If you want to break out, just throw an exception. - The only conditional statement allowed is
if(condition) throw SomeException();
. What more could you want? Exceptions can do anything. - No "return" statement. ValueFoundException should be good enough.
- All exception types should include the word "Exception" in the name for readability.
Some example code:
void bubble_sort(int array[], int length) { //quicksort is left as an exercise to the reader while(true) { int pos = 0; bool hasChanged = false; try { while(true){ if(pos >= length-1) throw ReachedTheEndException() try { if (array[i]>array[i+1]) throw ShouldFlipValuesException(); } catch ShouldFlipValuesException { std::swap(array[i], array[i+1]); hasChanged = true; } pos += 1; } } catch ReachedTheEndException() {}; if (!hasChanged) throw TaskCompletedException(); } } } void binary_search(const int array[], int low, int high, int value) { if (high < low) throw NotFoundException(); int mid = (low + high) / 2; try { if (value < array[mid]) throw ShouldLookLeftException(); if (value > array[mid]) throw ShouldLookRightException(); throw ValueFoundException(mid); } catch ShouldLookLeftException { binary_search(array, low, mid - 1, value); } catch ShouldLookRightException { binary_search(array, mid + 1, high, value); } }
- The only loop allowed is
-
@anonymous234 said in THE BAD IDEAS THREAD:
catch ShouldLookRightException(if (value > array[mid]) {
That line looks suspicious. Unbalanced parentheses…
-
@dkf Oops, copypaste fuckery.
-
-
@hardwaregeek said in THE BAD IDEAS THREAD:
But you're in rehab now?
23 years since I last dealt with Common Lisp. I've stopped counting the months.
-
@anonymous234 said in THE BAD IDEAS THREAD:
throw ValueFoundException(binary_search(array, low, mid - 1, value));
Is invalid, because
binary_search()
returns void.
-
@pleegwat Oooh right. My mind was poisoned by the old, obsolete programming model where functions return things.
Now the code looks even simpler!
-
@anonymous234 said in THE BAD IDEAS THREAD:
The only conditional statement allowed is if(condition) throw SomeException();. What more could you want? Exceptions can do anything.
? :
,&&
,||
(assuming C++ accepts throwing exceptions inside expressions)
-
@zecc said in THE BAD IDEAS THREAD:
(assuming C++ accepts throwing exceptions inside expressions)
It didn't until C++11 when we got restricted constexpr functions.
return pos < len? str[pos] : throw std::out_of_range{};
Not sure what other expressions
throw
can appear in but that's the only new context I'm aware of.
-
@lb_ said in THE BAD IDEAS THREAD:
It didn't until C++11 when we got restricted constexpr functions.
You sure? GCC 4.4 (pre-C++11) compiles stuff like
if( a || (throw Thing(), b) ) ...
-
@cvi Ah, well in that case it's because you could use a void-returning function in that context. I thought @Zecc meant something like
if(isTrue() || throw std::runtime_error{})
-
@lb_ said in THE BAD IDEAS THREAD:
I thought @Zecc meant something like
if(isTrue() || throw std::runtime_error{})I did, as I thought it might be possible. (why wouldn't it?)
-
Would it be sufficient to have
do { ... } until (exception); ...
(which would be equivalent totry while (1) { ... } catch (exception) { ... }
) and simple logic expressions withthrow
?
-
@zecc said in THE BAD IDEAS THREAD:
I did, as I thought it might be possible. (why wouldn't it?)
Because a
throw
expression is effectively a void-returning expression and cannot be used in any context where a value is expected, aside from the?:
operator special case that was added in C++11.
-
@lb_ said in THE BAD IDEAS THREAD:
@zecc said in THE BAD IDEAS THREAD:
I did, as I thought it might be possible. (why wouldn't it?)
Because a
throw
expression is effectively a void-returning expression and cannot be used in any context where a value is expected, aside from the?:
operator special case that was added in C++11.Someone teach the C++ people about the Never type.
-
@anonymous234 Rust does that too, with the
!
type.
-
@cvi said in THE BAD IDEAS THREAD:
GCC
Ah, that might be because gcc has all sorts of language extensions turned on by default.
-
@anonymous234 said in THE BAD IDEAS THREAD:
@lb_ said in THE BAD IDEAS THREAD:
@zecc said in THE BAD IDEAS THREAD:
I did, as I thought it might be possible. (why wouldn't it?)
Because a
throw
expression is effectively a void-returning expression and cannot be used in any context where a value is expected, aside from the?:
operator special case that was added in C++11.Someone teach the C++ people about the Never type.
We have
[[noreturn]]
for that, and I don't think there are yet any special cases for it.There are proposals to make
void
a value type similar tostd::monostate
so that you can write better generic code instead of having to special-case for functions that return void.
-
@lb_ said in THE BAD IDEAS THREAD:
@zecc said in THE BAD IDEAS THREAD:
I did, as I thought it might be possible. (why wouldn't it?)
Because a
throw
expression is effectively a void-returning expression and cannot be used in any context where a value is expected, aside from the?:
operator special case that was added in C++11.That's okay. You've already set the return value in a pass by reference argument.
-
@lb_ said in THE BAD IDEAS THREAD:
@anonymous234 said in THE BAD IDEAS THREAD:
@lb_ said in THE BAD IDEAS THREAD:
@zecc said in THE BAD IDEAS THREAD:
I did, as I thought it might be possible. (why wouldn't it?)
Because a
throw
expression is effectively a void-returning expression and cannot be used in any context where a value is expected, aside from the?:
operator special case that was added in C++11.Someone teach the C++ people about the Never type.
We have
[[noreturn]]
for that, and I don't think there are yet any special cases for it.The beauty of Never type is that there don't have to be any special cases. It's just like any other type, and can be used like any other type, and functions returning it are treated like functions returning any other type, except this type can never be instantiated (which means a compile-time guarantee that functions that should never return actually never return). Which is a completely different concept from
std::monostate
which has one valid value (ie. all instances are equal to each other).
-
@pie_flavor said in THE BAD IDEAS THREAD:
@anonymous234 Rust does that too, with the
!
type.I tried to see if Kotlin had something similar, but I've found Nothing.
-
@zecc said in THE BAD IDEAS THREAD:
I tried to see if Kotlin had something similar, but I've found Nothing.
-
@gąska ah that's neat. You can make a type like that manually in C++ but indeed it would be nice to have one in the standard library.
-
@lb_ not really - another property of Never type is that it's subtype of every other type, which means you can use a function returning Never in every context where an expression of other type is expected. Not very important in average C++ code, but in functional languages where everything is expression, it's a very useful property - though mostly not for actually never-returning code, but rather for functions that terminate in ways other than returning value, like Scala's
throw
statements, or Rust'sstd::process::exit
.
-
@Gąska this seems to work fine for me:
struct Never final { constexpr Never() noexcept = delete; constexpr Never(Never const &) noexcept = delete; constexpr Never(Never &&) noexcept = delete; constexpr Never &operator=(Never const &) noexcept = delete; constexpr Never &operator=(Never &&) noexcept = delete; template<typename T> [[noreturn]] constexpr operator T() const noexcept { throw; } };
-
This post is deleted!
-
@lb_ damn templates and implicit conversions. Too powerful for their own good... Although, I don't think you can assign function returning this
Never
class tostd::function<void()>
, can you? This kinda limits its usefulness in template-heavy code.
-
@gąska said in THE BAD IDEAS THREAD:
Although, I don't think you can assign function returning this
Never
class tostd::function<void()>
, can you? This kinda limits its usefulness in template-heavy code.Speaking of too powerful, you actually can thanks to the way
std::function
works: https://godbolt.org/g/5p1FiP