From: [email protected] [mailto:[email protected]] On
Behalf Of Jonathan S. Shapiro
Sent: Monday, April 04, 2011 2:22 PM
To: Discussions about the BitC language
Subject: Re: [bitc-dev] Inheritance and Existentialism

 

On Sat, Apr 2, 2011 at 7:01 AM, Sandro Magi <[email protected]> wrote:

Type classes are just post-hoc interfaces, so you're no longer limited to a
declaration-time hierarchy.


This is not quite true. First, interfaces (at least in Java/C#) are
populated by member functions. The "methods" of an interface therefore have
presumptive access to "internal" object state that is not generally
available. This is not true of type classes.

 

 

I wonder if we can break this presumption .eg passing in the object  to the
function needs to be explicitly stated . This is not as silly as it sounds I
think , because implicitly passing in state is not really appropriate for a
language which is trying to be ( and rightly so ) more pure and interface
methods that are pure should be treated different than those that are
not.... In fact this has annoyed me in the past on whether I needed to lock
something eg I don't need to lock it since it doesn't touch the object but
if some maintenance guy does add access ( which is probable ) it will be a
very nasty bug, 

 

Does this mean we can support such interfaces with type classes ? The
strength of this is the this pointer issue goes away  and its easy to
generate code for other systems like the CLR and in v 2.0 you MAY be able to
support implicit state but it isn't guaranteed. 

 

I did some more thinking on this and it drives me nuts so rather than
complicate things I will leave the suggestion as it is .. glad I'm not a
modern language designer. ;-) 

 

Ben

_______________________________________________
bitc-dev mailing list
[email protected]
http://www.coyotos.org/mailman/listinfo/bitc-dev

Reply via email to