Re: VERY simple question about "?"
- From: Robert Klemme <shortcutter@xxxxxxxxxxxxxx>
- Date: Mon, 05 Jan 2009 18:39:44 +0100
On 05.01.2009 03:38, Tom Cloyd wrote:
Robert Klemme wrote:On 04.01.2009 14:48, Tom Cloyd wrote:Meaning, in linguistics as I understand it,I guess what confused me is that I bring to Ruby the notion that if a symbol causes something to happen, as "?" clearly does in my example (it produces the integer code for a character),In this case nothing "happens" (see below). It is just another syntactical way to express an integer constant.
its' an operator or method. I'm not unfamiliar with linguistics. I don't see the equivalence between a string delimiter, or a character that signals the beginning of a symbol, and a symbol that is actually productive of something. Makes no sense to me at all, in fact. Maybe I'm failing to grasp some transformative concept which changes how things work in the Ruby world.I am not sure what you mean by "change meaning". Can you elaborate?
Seeing operators as methods makes some real sense, on the other hand. "=" produces something out of what it's given. It doesn't just change meaning, which is all that happens with quotes or ":". That's the distinction I'm seeing, and it seems valid.
Unfortunately we're in the domain of programming languages which is quite different from linguistics. Part of my difficulty understanding you is probably caused by the fact that you seem to try to tackle problems of computer languages with tools (terms and theories) from a complete different domain. While both domains happen to share terms I think it is not helpful to try to apply linguistics (i.e. the science of natural languages) to computer languages. It may actually hinder understanding.
Ditto for the use of ":" in symbols. The """ and the ":" are context indicators, but produce nothing. Not so for "+" in "a+b" or, I think "?a".
Actually I believe that "?a" does not belong in the same category as "a+b" because, as Dave and I have pointed out already, "?a" is just another way to write the integer 97 ("97", "0141" and "0x61" are other ways to write 97).
A "textural representation" that PRODUCES something?I'll keep thinking about it.Basically "?a" is just another textual representation for the integer 97 which happens to be the ASCII code of character "a". It differs from string delimiters because the expression "foo" is actually a String constructor - it will create a new String object whenever it is executed:
I did not mention "produce" in the context of - where do you take that from?
Doesn't make sense to me. Representations simply represent. They "stand for" something else, and do no more.
Yes, all these character sequences ("?a", "97", "0141" and "0x61") represent the Fixnum instance which in term is a technical representation (i.e. data) of the (mathematical) number 97. If an expression of a Ruby program is evaluate that contains any of these tokens, the token (which is an expression as well, more precisely a constant expression) evaluates to the said Fixnum instance.
Now, I can define method X, and then say that X "stands for" the method specification. That's true, from the compiler's point of view, among other things. But to say no more is misleading. "X" can be called, at which point it ACTS. "Tom" - my name can also be called, but when one does so IT doesn't spring into action at all. I might, but IT cannot.
It does, as my example demonstrated. Opposed to "?a" "'Tom'" is not a constant expression but a String constructor. (See my example below which I took the liberty to put together again.)
There is, I therefore assert, a fundamental difference here, and I think you're seeing that two different things have the same feature and
Actually I pointed out that "?a" and "'Tom'" are not the same sort of thing. (On a certain level they are of course: both are valid syntax constructs (tokens) of the Ruby language. Actually, both are even expressions which happen do have different semantics - constant vs. non constant).
concluding from that that they are the same sort of thing.
Again, I do not know where you take that from. This is certainly nothing I have intended to convey.
That argument is obviously flawed. "It's incomplete, as my "Tom" demonstrations shows. You say "Basically "?a" is just another textual representation for..." - I'd agree, except for that "just". That single word makes the statement incorrect, to my mind, and also reveals the problem I'm addressing.
Not at all. There are many ways to write down 97 in a Ruby program (as I have shown above). In that sense "?a" is just another way to write it down (assuming "97" is considered the most commonly used way).
irb(main):003:0> 3.times { x = "foo"; puts x, x.object_id }
foo
1073491940
foo
1073492040
foo
1073491880
=> 3
irb(main):004:0>
Cheers
robert
--
remember.guy do |as, often| as.you_can - without end
.
- References:
- VERY simple question about "?"
- From: Tom Cloyd
- Re: VERY simple question about "?"
- From: F. Senault
- Re: VERY simple question about "?"
- From: Yaser Sulaiman
- Re: VERY simple question about "?"
- From: Tom Cloyd
- Re: VERY simple question about "?"
- From: Robert Klemme
- Re: VERY simple question about "?"
- From: Tom Cloyd
- VERY simple question about "?"
- Prev by Date: Re: I can't uninstall a few gems
- Next by Date: Re: Coding a server
- Previous by thread: Re: VERY simple question about "?"
- Next by thread: A question about Net-ssh
- Index(es):
Relevant Pages
|