[bitc-dev] Type classes
Ben Kloosterman
bklooste at gmail.com
Thu Mar 31 19:23:28 PDT 2011
C# and .NET 1.0 had the same scheme but you were always checking if the type
is correct , casting and sometimes boxing ( since object is a reference
type) and generics gave quite a nice boost . Also as I said interfaces are
important here ( eg 1 or 2 members / fields tied to a type but multiple
interfaces) and I would prefer them to Inheritance if a choice had to be
made.
Personally I think in 2000 you could get away with just inheritance but not
any more . The real question is can you get away with them in v1 of Bitc
and promise something better ?
Ben
> -----Original Message-----
> From: bitc-dev-bounces at coyotos.org [mailto:bitc-dev-
> bounces at coyotos.org] On Behalf Of Matt Rice
> Sent: Friday, April 01, 2011 8:56 AM
> To: Discussions about the BitC language
> Cc: Jonathan S. Shapiro
> Subject: Re: [bitc-dev] Type classes
>
> On Wed, Mar 30, 2011 at 7:02 PM, Jonathan S. Shapiro <shap at eros-os.org>
> wrote:
> > is single inheritance and overloading sufficient?
>
> I really hate to make this comparison,
>
> but if you consider objective-c which uses the smalltalk object model, it
only
> has single inheritance, no overloading, and no templates/generics
>
> It gets away with this through 2 concepts, dynamic dispatch, and an utter
lack
> of type safety, 'everything is an object'.
>
> with type variables in place, changing 'everything is an object' to
'everything
> is of some type'. you must add overloading which gives us dispatch though
> not dynamic.
>
> squint your eyes, and you have a rough equivalence to something which has
> proven to be sufficient (within the universe where it has been accepted.),
> the major difference is the lack of dynamic dispatch, which is not
something
> type classes is just going to give you.
>
> I personally find it sufficient.
>
> (I don't know smalltalk but do know objective-c so didn't want to make the
> comparison directly)
>
> note: objective-c has something roughly equivalent type classes which they
> call 'protocols', these were added to give some mediocre amount of type
> safety to an otherwise unsafe language (to ensure that an object
> implements the methods required).
> _______________________________________________
> bitc-dev mailing list
> bitc-dev at coyotos.org
> http://www.coyotos.org/mailman/listinfo/bitc-dev
More information about the bitc-dev
mailing list