RCR 297: Warn about use of ++ and --
Submitted by aredridel (Mon Mar 21 02:02:00 UTC 2005)
Abstract
An often unexpected surprise of Ruby is that ++ and -- are non-operations.
Problem
There is confusion that ++ and -- are silent non-operations for integer types. Programmers familiar with languages that have these operators are often confused.
Proposal
Warn about the use of ++ and --, perhaps only when the -w flag is set.
Analysis
Making the error obvious would be best handled at the parsing stage, so that ++ can be warned about, but +(+()) would not.
Implementation
No implementation in pure ruby is particularly feasible.
This seems like a good idea.
As I was a newbie, Googled told me why this is not a good idea (mail on a mailing list). Ruby should have told me instead IMO. :)
Why don't we just make x++ mean x = x.succ() and x-- mean x = x.prev() or something?
|
Strongly opposed |
1 |
Opposed |
0 |
Neutral |
2 |
In favor |
17 |
Strongly advocate |
3 |
|
RCRchive copyright © David Alan Black, 2003-2005.
Powered by .
As I was a newbie, Googled told me why this is not a good idea (mail on a mailing list). Ruby should have told me instead IMO. :)
Why don't we just make x++ mean x = x.succ() and x-- mean x = x.prev() or something?