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
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
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: beginners-bounces@lists.squeakfoundation.org [mailto:beginners-bounces@lists.squeakfoundation.org] 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@lists.squeakfoundation.org