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

Philippe Marschall philippe.marschall at gmail.com
Thu Nov 1 13:18:39 UTC 2007


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. 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.

Cheers
Philippe

> > For the rest don't even get me started.
>
> This is always an arguable topic.
>
> > We'll change this, we'll introduce our own String conversion method :-/
>
> Great.
>
> I found another difference, ByteArray>>#displayString in Squeak answer
> aString with characters from its elements.
> In Dolphin displayString displays the ByteArray in its own
> displayString format (printString) which for
> #(97 99 99) asByteArray displayString "displayIt" #[97 98 99]
>
> because Dolphin has a special syntax for byte arrays, which is  #[].
>
> But...
> #(97 98 99) asByteArray asString -> 'abc' "displayIt"
>
> Semantically speaking, for conversion (which is the case), IMO
> #asString is the proper message.
>
> Is #displayString widely used to convert ByteArrays to strings in Seaside?
>
>
> Best regards,
>
> --
> Esteban A. Maringolo
> eMaringolo at gmail.com
> _______________________________________________
> seaside-dev mailing list
> seaside-dev at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev
>


More information about the seaside-dev mailing list