Object.st
changeset 25379 609d492f29a7
parent 25252 826c0e1220af
equal deleted inserted replaced
25378:a95e315ed8b4 25379:609d492f29a7
   590     "VW compatibility"
   590     "VW compatibility"
   591 
   591 
   592     "/ kept in libbasic package, because it is used by the refactory code
   592     "/ kept in libbasic package, because it is used by the refactory code
   593     self errorKeyNotFound:aKey.
   593     self errorKeyNotFound:aKey.
   594 ! !
   594 ! !
   595 
       
   596 
   595 
   597 
   596 
   598 !Object methodsFor:'accessing'!
   597 !Object methodsFor:'accessing'!
   599 
   598 
   600 _at:index
   599 _at:index
  8648      If it's understood, return the method's returned value,
  8647      If it's understood, return the method's returned value,
  8649      otherwise return the value of the exceptionBlock.
  8648      otherwise return the value of the exceptionBlock.
  8650      Read this:
  8649      Read this:
  8651      Many programmers do an Error-handle to perform a similar
  8650      Many programmers do an Error-handle to perform a similar
  8652      checked-message send. However, this method is more specific,
  8651      checked-message send. However, this method is more specific,
  8653      in that only errors for the given selector are caught - not any other
  8652      in that only errors for the given selector and this receiver are caught - not any other
  8654      doesNotUnderstand, and especially not any other error."
  8653      doesNotUnderstand, and especially not any other error."
  8655 
  8654 
  8656     ^ [
  8655     ^ [
  8657 	self perform:aSelector.
  8656         self perform:aSelector.
  8658     ] on:MessageNotUnderstood do:[:ex |
  8657     ] on:MessageNotUnderstood do:[:ex |
  8659 	"/ reject, if the bad message is not the one
  8658         "/ reject, if the bad message is not the one
  8660 	"/ we have sent originally
  8659         "/ we have sent originally
  8661 	(ex selector == aSelector and:[ex receiver == self]) ifFalse:[
  8660         (ex selector == aSelector and:[ex receiver == self]) ifFalse:[
  8662 	    ex reject
  8661             ex reject
  8663 	].
  8662         ].
  8664 	exceptionBlock value
  8663         exceptionBlock value
  8665     ].
  8664     ].
  8666 
  8665 
  8667     "
  8666     "
  8668      1.2345 perform:#foo ifNotUnderstood:['sorry']
  8667      1.2345 perform:#foo ifNotUnderstood:['sorry']
  8669      1.2345 perform:#sqrt ifNotUnderstood:['sorry']
  8668      1.2345 perform:#sqrt ifNotUnderstood:['sorry']
  8670      12345 perform:#sqrt ifNotUnderstood:['sorry']
  8669      12345 perform:#sqrt ifNotUnderstood:['sorry']
  8671     "
  8670     "
  8672 
  8671 
  8673     "Modified (comment): / 13-02-2017 / 20:27:38 / cg"
       
  8674     "Modified: / 15-03-2017 / 17:05:58 / stefan"
  8672     "Modified: / 15-03-2017 / 17:05:58 / stefan"
       
  8673     "Modified (comment): / 03-05-2020 / 13:19:31 / cg"
  8675 !
  8674 !
  8676 
  8675 
  8677 perform:aSelector with:argument ifNotUnderstood:exceptionBlock
  8676 perform:aSelector with:argument ifNotUnderstood:exceptionBlock
  8678     "try to send message aSelector to the receiver.
  8677     "try to send message aSelector to the receiver.
  8679      If it's understood, return the method's returned value,
  8678      If it's understood, return the method's returned value,