Feature #1432
closeddecrement and increment
Added by OlegPuchinin (Oleg Puchinin) over 15 years ago. Updated over 13 years ago.
Description
=begin
What about (C) ++/-- ?
=end
Updated by matz (Yukihiro Matsumoto) over 15 years ago
- Status changed from Open to Rejected
=begin
You can't define object-oriented semantics for increment/decrement operations. They are assignments in theory.
=end
Updated by rogerdpack (Roger Pack) over 15 years ago
=begin
at times I do miss the elegance of being able to do ++
though it does hide the fact that it's internally assignment. Primitives aren't quite as objecty as "normal" objects, so might be an appropriate fit. Just thinking out loud.
-=r
=end
Updated by brent (Brent Roman) over 15 years ago
=begin
Why is
a+=1
less elegant than
++a
However, I admit that using
(x=a; a+=1; x)
to replace
a++
is pretty evil looking. (The postfix variants are a pain to emulate
correctly)
Are there other commonly used languages besides 'C' that support the ++ and
-- operators?
I always thought they were added to 'C' primarily to support efficient
pointer arithmetic --
something quite foreign to Ruby.
- brent
Nobuyoshi Nakada-3 wrote:
Issue #1432 has been updated by Roger Pack.
at times I do miss the elegance of being able to do ++
though it does hide the fact that it's internally assignment. Primitives
aren't quite as objecty as "normal" objects, so might be an appropriate
fit. Just thinking out loud.
-=rhttp://redmine.ruby-lang.org/issues/show/1432
--
View this message in context: http://www.nabble.com/-ruby-core%3A23357---Feature--1432--decrement-and-increment-tp23366229p23399031.html
Sent from the ruby-core mailing list archive at Nabble.com.
=end
Updated by rogerdpack (Roger Pack) over 15 years ago
=begin
yeah ++ is the one I miss.
-=r
=end
Updated by matz (Yukihiro Matsumoto) over 15 years ago
=begin
Hi,
In message "Re: [ruby-core:23405] Re: [Feature #1432] decrement and increment"
on Sat, 9 May 2009 15:38:53 +0900, "C.E. Thornton" admin@hawthorne-press.com writes:
|The question comes down to this:
|
| Are we going to allow "Synatic Suger" of this
| sort into Ruby? We already do in sense - By allowing
| more than one way to do things in most situations.
The answer is
we have to mind to add sugars easily
just because syntax sugar is modifying the syntax, and you have to be
slow to modify the syntax.
If we decide to add this particular sugar after serious consideration,
the following question arise:
what is the result of "syntax sugar" conversion. simple += 1 is
suffice, or no?
matz.
=end