I’m curious – exactly what class of syntactic element is =
in Ruby,
where “class of syntactic element” is roughly analogous to “part of
speech”. If objects are nouns and methods are verbs, that means =
is
neither a noun nor a verb. Is it a participle? Is it punctuation? If
it’s a participle, I’d like to know what class of syntactic element that
is in Ruby. If it’s punctuation, I’d like some explanation for how that
works conceptually – because I think of punctuation in Ruby as being
stuff like the parentheses around a method argument.
Anyone? Bueller?
Chad P. wrote:
If objects are nouns and methods are verbs
class Dog
attr_accessor :bite
#define = method:
def bite=(str)
@bite = str
end
end
d = Dog.new
d.bite = “worse than my bark”
puts d.bite
On Oct 8, 2007, at 6:42 PM, Jason P. wrote:
it’s a participle, I’d like to know what class of syntactic
http://en.wikipedia.org/wiki/Linking_verb
FWIW, I’ve read that modules can be considered adjectives, which fits
in nicely with what you’re doing.
–
Jason P.
[email protected]
“The computer allows you to make mistakes
faster than any other invention, with the
possible exception of handguns and tequila.”
-Mitch Ratcliffe
On Oct 8, 2007, at 5:44 PM, Chad P. wrote:
works conceptually – because I think of punctuation in Ruby as being
stuff like the parentheses around a method argument.
Anyone? Bueller?
I think it might be consider a copula. See <http://en.wikipedia.org/
wiki/Copula>.
Regards, Morton
On Oct 8, 2007, at 4:44 PM, Chad P. wrote:
works conceptually – because I think of punctuation in Ruby as being
stuff like the parentheses around a method argument.
Anyone? Bueller?
Wouldn’t it be a linking verb, such as ‘is’?
http://en.wikipedia.org/wiki/Linking_verb
–
Jason P.
[email protected]
“The key to performance is elegance, not
battalions of special cases.”
-Jon Bentley and Doug McIlroy
On 10/8/07, Morton G. [email protected] wrote:
is in Ruby. If it’s punctuation, I’d like some explanation for how
that
works conceptually – because I think of punctuation in Ruby as being
stuff like the parentheses around a method argument.
Anyone? Bueller?
I think it might be consider a copula. See <http://en.wikipedia.org/
wiki/Copula>.
Regards, Morton
I agree with Morton a little here, since “a = b” doesn’t necessarily
mean “a is b”.
I suppose it’s all about how far you want to take it conceptually.
Like, for example, in my head I see “a = b” as “a tries to put on b’s
shoes”, or to make it more short, something like, “b marries a”.
In another language, that might sound more like “b, a, they become
together for a while”.
For all simplicity, though, I guess the copula term could best
describe it for the English language.
Not a straight answer, but, there you go.
class C
def []= something
puts “hello”
end
end
b = C.new[] = “hola”
The semantics break down when you look at a single symbol (in this
case, ‘=’) and try to replace it with a word (be it verb, transitive,
cupola or otherwise).
I don’t know your use case, but I think it’s impossible to translate a
programming language into a spoken one. I would be fascinated if you
could prove me wrong though.
Todd
On Oct 8, 2007, at 10:38 PM, M. Edward (Ed) Borasky wrote:
In Pascal, “a := b” is normally read as “a becomes b”. So in Ruby,
I would translate “a = b” as “a becomes a reference to b”.
It’s more “a becomes a reference to the object b is referencing”, or
better yet “a is now bound to the same object as b [is bound to]”. My
suggestion identifying “=” with the English copula is very tentative.
It’s probably futile to try to force English syntactic terminology
onto Ruby.
Regards, Morton
Jason P. wrote:
stuff like the parentheses around a method argument.
“The key to performance is elegance, not
battalions of special cases.”
-Jon Bentley and Doug McIlroy
In Pascal, “a := b” is normally read as “a becomes b”. So in Ruby, I
would translate “a = b” as “a becomes a reference to b”.
I don’t know your use case, but I think it’s impossible to translate a
programming language into a spoken one. I would be fascinated if you
could prove me wrong though.
Todd
chad.convert2lang(code) ? tod=fascinated : tod=right
really would be fascinating though
On Tuesday 09 October 2007 12:45 am, Morton G. wrote:
On Oct 8, 2007, at 10:38 PM, M. Edward (Ed) Borasky wrote:
In Pascal, “a := b” is normally read as “a becomes b”. So in Ruby,
I would translate “a = b” as “a becomes a reference to b”.
It’s more “a becomes a reference to the object b is referencing”, or
better yet “a is now bound to the same object as b [is bound to]”. My
suggestion identifying “=” with the English copula is very tentative.
It’s probably futile to try to force English syntactic terminology
onto Ruby.
(A newbie (or slow learning oldbie) lurker chiming in): If you’re a
*nix
user, a way of thinking about it that seems to help me (because I think
now I
finally am beginning to understand it) is as analogous to a hard link in
Linux–a and b are alternate names for an object, and a = b is the act
of
creating the alternate name a.
So maybe (I’m thinking about this) I’d read a = b as one of:
- create a new name a for b
- (hard) link a to b
- ???
(I call it a hard link instead of a soft link because I think the hard
link is
a closer analogy.)
Randy K.
On Tue, Oct 09, 2007 at 10:33:21AM +0900, Morton G. wrote:
is in Ruby. If it’s punctuation, I’d like some explanation for how
that
works conceptually – because I think of punctuation in Ruby as being
stuff like the parentheses around a method argument.
Anyone? Bueller?
I think it might be consider a copula. See <http://en.wikipedia.org/
wiki/Copula>.
Okay . . . so what programming language syntactic element is analogous
to
a coupla?
verb = method
noun = object
coupla = ?
On 10/9/07, Shai R. [email protected] wrote:
I don’t know your use case, but I think it’s impossible to translate a
programming language into a spoken one. I would be fascinated if you
could prove me wrong though.
Todd
chad.convert2lang(code) ? tod=fascinated : tod=right
really would be fascinating though
Ouch. That hurts the feelings a little bit, but it makes for a good
joke
How about (which is not a joke)…
ruby.convert2reason( tod ) ? ros = fascinated : ros = right
I’m pretty mature when it comes to open forums, but I have to be
honest (again), in this one I just can’t figure people out. Maybe
that’s a good thing?
Todd
On Oct 9, 2007, at 5:06 PM, Chad P. wrote:
it’s a participle, I’d like to know what class of syntactic element
wiki/Copula>.
Okay . . . so what programming language syntactic element is
analogous to
a coupla?
verb = method
noun = object
coupla = ?
I am suggesting, very tentatively, that
copula = variable binding
Regards, Morton