[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-smalltalk] gst-shape
From: |
Gwenaël Casaccio |
Subject: |
Re: [Help-smalltalk] gst-shape |
Date: |
Mon, 18 Oct 2010 12:37:04 +0200 |
Thanks,
I'll do a pass and fix it
Cheers,
Gwen
On Mon, Oct 18, 2010 at 12:05 PM, Paolo Bonzini <address@hidden> wrote:
> On 10/18/2010 11:42 AM, Gwenaël Casaccio wrote:
>>
>> Hi,
>>
>> I would like to announce gst-shape git://github.com/MrGwen/gst-shape.git
>> a refactoring of the class shape, a small example of the power of this new
>> refactoring:
>
> This is very nice, thanks. You can also use a branch of smalltalk.git
> rather than a fully separate repository. This will make it easier for me to
> pull.
>
> However, I wouldn't use class methods. I think it's bad design. It's better
> to use a simpler hierarchy and put these on the instance side using instance
> variables:
>
> Shape "class methods for mapping integers to ShapeSymbol instance"
> VMShape
> FixedShape "current NilShape"
> IntegerShape "adds #byteSize, #byteSize:"
> SignedIntegerShape
> UnsignedIntegerShape
> FloatingPointShape
> CharacterShape
> EncodedCharacterShape
> UnicodeCharacterShape
> ShapeAliasSymbol "abstract class maybe not necessary"
> ShapeInherit
> ShapeWord
>
> This is because you can use #nextBytes:signed: and #nextPutBytes:of: to
> implement dumping. Those methods are private, but we can un-privatize them.
>
> "wrongClassIfFloatOrDoubleShape:" and "wrongClassIfCharacterOrUtf32Shape:"
> can be unified to "checkArgumentClass:".
>
> The "subclassResponsibilityIfCharacterOrUtf32Shape" and
> "subclassResponsibilityIfNotCharacterOrUtf32Shape" methods are also bad.
> First of all, the former should not be used (it's always using #ifFalse: in
> kernel/CharArray.st). Second, I'd anyway use a method #hasValueAtPrimitives
> that returns true/false.
>
> Thanks,
>