Re: a = Dog.new # a is not a pointer and not a reference?
- From: "David A. Black" <dblack@xxxxxxxxxxx>
- Date: Sun, 30 Sep 2007 20:27:57 +0900
Hi --
On Sun, 30 Sep 2007, SpringFlowers AutumnMoon wrote:
Morton Goldberg wrote:On Sep 29, 2007, at 8:18 PM, SpringFlowers AutumnMoon wrote:
Come to think about it, a pointer is very clear cut... an alias is
very
clear cut. but when it is "reference", then you have to think whether
it is the pointer behavior or the alias behavior.
No, you do not. Ruby has it own semantics, which do not correspond
with the semantics of C or C++. Trying to impose the semantics of
other languages onto Ruby isn't going to work. It's best to drop such
baggage and start fresh.
hm,... but is there a problem to think of reference in Ruby as a
"pointer"? will that cause any trouble? I only see that a.value is
not the same as C and C++ would use a->value, but in Ruby we use the "."
to replace the "->" and that's it. Will there be further trouble or
discrepancy to think of Ruby reference as a pointer?
Imagine if you went to a C mailing list and announced that you were
going to call pointers "references". That's the main issue: you're
making up new terminology instead of using the terminology used by
creator of Ruby and by people who have been using and talking about
the language for years and years.
The dot in Ruby is the dot in Ruby. It's not a replacement for
anything else. It's actually pretty easy to understand; it means "send
a message to this object". There's no need to go looking for what it
would mean if this weren't Ruby.
David
--
Upcoming training from Ruby Power and Light, LLC:
* Intro to Ruby on Rails, Edison, NJ, October 23-26
* Advancing with Rails, Edison, NJ, November 6-9
Both taught by David A. Black.
See http://www.rubypal.com for more info!
.
- References:
- a = Dog.new # a is not a pointer and not a reference?
- From: SpringFlowers AutumnMoon
- Re: a = Dog.new # a is not a pointer and not a reference?
- From: Morton Goldberg
- Re: a = Dog.new # a is not a pointer and not a reference?
- From: Austin Ziegler
- Re: a = Dog.new # a is not a pointer and not a reference?
- From: SpringFlowers AutumnMoon
- Re: a = Dog.new # a is not a pointer and not a reference?
- From: SpringFlowers AutumnMoon
- Re: a = Dog.new # a is not a pointer and not a reference?
- From: Morton Goldberg
- Re: a = Dog.new # a is not a pointer and not a reference?
- From: SpringFlowers AutumnMoon
- a = Dog.new # a is not a pointer and not a reference?
- Prev by Date: Re: which language allows you to change an argument's value?
- Next by Date: Re: which language allows you to change an argument's value?
- Previous by thread: Re: a = Dog.new # a is not a pointer and not a reference?
- Next by thread: Re: a = Dog.new # a is not a pointer and not a reference?
- Index(es):
Relevant Pages
|