The Artima Developer Community
Sponsored Link

Agile Buzz Forum
Super weirdness

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
James Robertson

Posts: 29924
Nickname: jarober61
Registered: Jun, 2003

David Buck, Smalltalker at large
Super weirdness Posted: Oct 2, 2003 12:13 PM
Reply to this message Reply

This post originated from an RSS feed registered with Agile Buzz by James Robertson.
Original Post: Super weirdness
Feed Title: David Buck - Blog
Feed URL: http://www.cincomsmalltalk.com/rssBlog/buck-rss.xml
Feed Description: Smalltalk can do that
Latest Agile Buzz Posts
Latest Agile Buzz Posts by James Robertson
Latest Posts From David Buck - Blog

Advertisement
I always say that the two strangest things in the Smalltalk syntax are blocks (by far the strangest) and super. Here are some things that will test your intuitions about super. What happens in each case?

Case 1:

someMethod
   [:x | x foo: 'john'] value: super

Does it call foo: in the subclass or the superclass?

Case 2:

someMethod
   ^super

SomeClass new someMethod foo: 'peter'

Is foo: the subclass or superclass implementation?

Case 3:

someMethod
   super
      bar;
      foo: 'Peter'

Which foo: is called?

In all these cases, would you have been able to tell if you hadn't tried it? (Hint - try it in other Smalltalks - the answers may be different.)

Read: Super weirdness

Topic: Can't hear it too much... Previous Topic   Next Topic Topic: If continuations confuse you...

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use