What does the -> symbol mean?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

What does the -> symbol mean?

Andy Burnett
I can't find it in my introductory books. The content was:

self entries add: aString -> aBlock

Is it a bit like the underscore character being the same as :=  ?

thanks
AB

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: What does the -> symbol mean?

Benjamin Schroeder-2

On Jul 29, 2008, at 8:02 PM, Andy Burnett wrote:

> I can't find it in my introductory books. The content was:
>
> self entries add: aString -> aBlock
>
> Is it a bit like the underscore character being the same as :=  ?

It's actually a binary (one-argument, infix) method, like +, =, or ==;  
it's the - and > characters put together rather than being a  
specialized glyph like the left arrow was. It creates an Association,  
which is a key-value pair used in things like Dictionaries.

If I remember correctly, any characters which can be used for binary  
methods can be strung together to make other binary methods -  
sometimes you'll see these turn up in specialized contexts. For  
example, there's also ==>, on Booleans, for implication ("a implies b").

Ben Schroeder

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

AW: What does the -> symbol mean?

Loew Uwe (DS/EES1)
In reply to this post by Andy Burnett
Hello Andy,
 
you can find the code behind this in the instance classes of Object.
-> and => are both answering an Association with the sender as key and the argument as value.
 
Best regards

Uwe Loew 
 

Von: [hidden email] [mailto:[hidden email]] Im Auftrag von Andy Burnett
Gesendet: Mittwoch, 30. Juli 2008 02:03
An: Squeak list
Betreff: [Newbies] What does the -> symbol mean?

I can't find it in my introductory books. The content was:

self entries add: aString -> aBlock

Is it a bit like the underscore character being the same as :=  ?

thanks
AB

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners