Skip to content

Instantly share code, notes, and snippets.

@nattybear
Last active January 17, 2021 13:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nattybear/300d508684ba64d987a54daf8e039fc2 to your computer and use it in GitHub Desktop.
Save nattybear/300d508684ba64d987a54daf8e039fc2 to your computer and use it in GitHub Desktop.

이 글은 Canol Gokel님이 만든 Computer Programming using GNU Smalltalk를 읽고 정리한 것이다.

Message Chaining

객체 옆에 메세지를 여러 개 적으면 모든 메세지는 앞의 메세지의 결과 객체에 전달된다.

이런 과정을 메세지 체이닝 message chaining 이라고 한다.

메세지 체이닝의 형태는 아래와 같다.

objectName message1 message2 message3 ... messageN

message은 바로 objectName에 전달된다.

message2는 앞의 objectName message1의 결과에 전달이 된다.

아래는 실제 예제이다.

st> 'Canol' reverse asUppercase
'LONAC'

Computer Programming with GNU Smalltalk

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment