I'm not sure that I'd want a complete backtrace, but I would want at least the caller's line and filename. -- Austin Ziegler
Okay... I figured a backtrace would be necessary because:
1. If you call it directly from within part of your script, you would want to know the line number and file from your script (Kernel.caller[0])
2. If the warning is in a function defined in a file you required/loaded, you would want to know where your script called it. (Kernel.caller[1])
3. The call to warn! might be buried a few functions deep, away from the data that caused the warning. Especially if you use recursive function calls.
Since it would be impossible to know which context the warning was issued from, it seemed to me that a backtrace would be simplest. If people think otherwise, though, I'll change the RCR. --Mark
Can I rant about the name? I don't think the "!" is a good choice in this case. This is not a "dangerous" method --gabriele.renzi
I agree. method! means that calling the method is dangerous, and calling warn isn't dangerous (or shouldn't be :-) -- David Black
Although I know that many tutorials call the bang methods "dangerous", I never thought of them in that way... To me, it more indicates the strength, or thoroughness of the method. That is, "chomp!" *really* chomps that string... as if by shouting the method name, you can get it to do more work :) Thinking about it this way, it makes sense to name the method "warn!", since it's doing more work, doing a more thorough job of it.
But that's just me. If the method name doesn't make sense to most people, it shouldn't be chosen. This RCR is pretty well tied to the method name, so if you don't like the name, please vote against it! :) --Mark
I like being able to get a backtrace from a warning, but I don't think an additional method is necessary. With a warning framework (RCR#180), it should be easy to add a backtrace to all warnings, but only have the backtrace displayed if the warn func chooses to display it.
-- Paul Brannan
To me, methods ending with '!' changes the object. Does 'warn!' change 'main'?
I'm not sure that I'd want a complete backtrace, but I would want at least the caller's line and filename. -- Austin Ziegler
Okay... I figured a backtrace would be necessary because:
1. If you call it directly from within part of your script, you would want to know the line number and file from your script (Kernel.caller[0])
2. If the warning is in a function defined in a file you required/loaded, you would want to know where your script called it. (Kernel.caller[1])
3. The call to warn! might be buried a few functions deep, away from the data that caused the warning. Especially if you use recursive function calls.
Since it would be impossible to know which context the warning was issued from, it seemed to me that a backtrace would be simplest. If people think otherwise, though, I'll change the RCR. --Mark
Can I rant about the name? I don't think the "!" is a good choice in this case. This is not a "dangerous" method --gabriele.renzi
I agree. method! means that calling the method is dangerous, and calling warn isn't dangerous (or shouldn't be :-) -- David Black
Although I know that many tutorials call the bang methods "dangerous", I never thought of them in that way... To me, it more indicates the strength, or thoroughness of the method. That is, "chomp!" *really* chomps that string... as if by shouting the method name, you can get it to do more work :) Thinking about it this way, it makes sense to name the method "warn!", since it's doing more work, doing a more thorough job of it.
But that's just me. If the method name doesn't make sense to most people, it shouldn't be chosen. This RCR is pretty well tied to the method name, so if you don't like the name, please vote against it! :) --Mark
I like being able to get a backtrace from a warning, but I don't think an additional method is necessary. With a warning framework (RCR#180), it should be easy to add a backtrace to all warnings, but only have the backtrace displayed if the warn func chooses to display it.
-- Paul Brannan
To me, methods ending with '!' changes the object. Does 'warn!' change 'main'?