I could see some value to supporting an asZnEntity protocol. As an example, say I have an API which needs to support various output formats. I could build my classes to use the appropriate entity builder when responding to asZnEntity so that in the server code I only need to do ZnResponse ok: myresponse asZnEntity, or just ZnResponse ok: myresponse if ok: sends asZnEntity. Matt On Jul 1, 2011, at 11:12 AM, Igor Stasenko wrote:
On 1 July 2011 16:55, Sven Van Caekenberghe <sven@beta9.be> wrote:
On 01 Jul 2011, at 15:52, Janko Mivšek wrote:
I'd just introduce yet that ZnResponse ok: 'Hello world'. To cover the most common response body and this will be really easy to grasp for newcomers. Nothing specially to learn upfront, just that simple two lines with seamless way to respond with some text.
This complicate a bit Zinc internals, but the gain on simplicity on API level is IMHO worth that.
I saw your code, and I considered it, but it feels too much out of place (the implementation that is), architecturally wrong and not that usefull. Although ZnResponse ok: (ZnEntity text: 'Hello World!') is longer it is also more intention revealing, it tells you something about HTTP without being too verbose.
These are opinions and aesthetics, of course.
IMO. API should be focused on most often use cases. Not on useless cases , like showing 'hello world'. Because going that road, you will just ruin the beautiful design of what you really need in favor of supporting useless things.
Sven
-- Best regards, Igor Stasenko AKA sig.