[Seaside-dev] WAPlatformTest>>#testAsString against convention

Esteban A. Maringolo emaringolo at gmail.com
Thu Nov 1 13:25:26 UTC 2007


On 11/1/07, Philippe Marschall <philippe.marschall at gmail.com> wrote:
> 2007/11/1, Esteban A. Maringolo <emaringolo at gmail.com>:
> > Hi Philippe,
> > On 10/31/07, Philippe Marschall <philippe.marschall at gmail.com> wrote:
> > > 2007/10/31, Esteban A. Maringolo <emaringolo at gmail.com>:
> > > > In the coding conventions in
> > > > <http://www.seaside.st/community/conventions> it mentions the
> > > > avoidance of #asString.  However, WAPlatformTest>>#testAsString uses
> > > > it for testing.
> > > > Should I omit this test?
> >
> > > The conventions are outdated.
> >
> > :-/
> >
> > > You have to use #asString for converting Symbols to Strings.
> >
> > Yes, for conversion #as* should be used.
>
> Not all dialects support #asString on all Objects.

And I'm from the group that believes that's ok.

> If you add it to object, they fall apart.
> Kent Beck argues that #as* should only be
> used for conversion to compatible types, like from Array to Set, but
> not from Number to String.

To me, #as* should be used if the conversion is reflective, it is...
#(1 2 3) asByteArray asArray -> #(1 2 3)
1 asString asNumber -> 1

However, as told before, this is a very arguable topic, so let's keep
talking about Seaside...

Regards,

-- 
Esteban A. Maringolo
eMaringolo at gmail.com


More information about the seaside-dev mailing list