help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-smalltalk] Iliad - asResponse implementation


From: Paolo Bonzini
Subject: Re: [Help-smalltalk] Iliad - asResponse implementation
Date: Mon, 22 Jun 2009 09:45:40 +0200
User-agent: Thunderbird 2.0.0.17 (X11/20081009)

Stefan Schmiedl wrote:
While looking around in Iliad source code, I noticed that
Object>>asResponse is implemented using Object>>printString.

Dolphin Smalltalk makes a -- quite useful -- distinction
between

  printString   - what the developer wants to see
  displayString - what the user gets to see

GNU Smalltalk also has the same distinction, as you surely know:

 'abc' printString = '''abc'''   (prints as 'abc')
 'abc' displayString = 'abc'     (prints as abc without quotes)

Also, I'm seeing that Iliad.Response supports the "usual"
streaming methods #nextPut: and #nextPutAll. What about

Object extend [
    asResponse [
        | response |
        <category: 'converting'>
        response := Iliad.Response ok.
        self respondOn: response.
        ^response
    ]
    respondOn: aResponse [
        <category: 'responding'>
        self displayOn: aResponse.
    ]
]

Yes, looks nice.

Paolo




reply via email to

[Prev in Thread] Current Thread [Next in Thread]