Mailing List Archive
tlug.jp Mailing List tlug archive tlug Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]Re: [tlug] STM (was: Re: work times & accommodation @tokyo)
- Date: Wed, 30 Jul 2008 10:06:40 +0900
- From: "Stephen J. Turnbull" <stephen@example.com>
- Subject: Re: [tlug] STM (was: Re: work times & accommodation @tokyo)
- References: <20080728114336.GA18114@lucky.cynic.net> <d8fcc0800807280554m1db06f1aq3a58205b1f9861ea@mail.gmail.com> <20080728144249.GA26262@lucky.cynic.net> <d8fcc0800807280805g11e1165cg7252a6b9c9017771@mail.gmail.com> <20080728160250.GB26262@lucky.cynic.net> <d8fcc0800807280949y71d562a4lad5773cf142d3f11@mail.gmail.com> <20080729004756.GF26262@lucky.cynic.net> <87skttcco4.fsf@uwakimon.sk.tsukuba.ac.jp> <20080729093315.GJ16234@lucky.cynic.net> <87myk0cyud.fsf@uwakimon.sk.tsukuba.ac.jp> <20080729233618.GE5154@lucky.cynic.net>
Curt Sampson writes: > On 2008-07-30 03:46 +0900 (Wed), Stephen J. Turnbull wrote: > > > Curt Sampson writes: > > > > > The point is, the compiler's type checker in Java is not poweful enough > > > to tell you when you've used your library incorrectly, > > > > That's a pretty strong assertion. > > Indeed, it is. But anybody here is free to prove me wrong by showing me > an example of how this might be done. Hey, you acknowledged that the transactional aspect could be implemented. So the question is how to arrange for type-checking. Make it a separate class, with private members for the value and the log. The accessors and mutators take care of protecting it from impure operations (ie, maintaining the log); pure operations are implemented as methods. True, Haskell's monads will allow you to let the compiler do a lot of the typechecking work *inside* the library implementation, and Java's won't. However, I don't see why Java wouldn't be able to tell you you're *using* the library incorrectly by throwing a type mismatch when you try to process a TVar with an unsafe function. > The really short explanation is that Haskell forces you to > distinguish pure and impure operations, I don't think this is true for STM, since it's not a cut-and-dried situation like with the IO monad. > and type your impure operations. Well, I can't be absolutely sure that Java can do this, but C++ will. It's very painful, but there is such code in XEmacs that is used to static check int-char confusion. You have to override a huge number of conversions that are provided by default, of course. I think it would actually be quite a bit easier to create a TVar class. (This is where monads come in, of course; they automatically override -- turn into errors -- a lot of compositions that C family languages have to specify one by one.) > [This] is not the place for a long tutorial paper on the Haskell > type system, monads, and so on anyway. I think you're underestimating how much I know about formal type systems.
- Follow-Ups:
- Re: [tlug] STM (was: Re: work times & accommodation @tokyo)
- From: Curt Sampson
- References:
- Re: [tlug] STM (was: Re: work times & accommodation @tokyo)
- From: Curt Sampson
- Re: [tlug] STM (was: Re: work times & accommodation @tokyo)
- From: Josh Glover
- Re: [tlug] STM (was: Re: work times & accommodation @tokyo)
- From: Curt Sampson
- Re: [tlug] STM (was: Re: work times & accommodation @tokyo)
- From: Josh Glover
- Re: [tlug] STM (was: Re: work times & accommodation @tokyo)
- From: Curt Sampson
- Re: [tlug] STM (was: Re: work times & accommodation @tokyo)
- From: Josh Glover
- Re: [tlug] STM (was: Re: work times & accommodation @tokyo)
- From: Curt Sampson
- Re: [tlug] STM (was: Re: work times & accommodation @tokyo)
- From: Stephen J. Turnbull
- Re: [tlug] STM (was: Re: work times & accommodation @tokyo)
- From: Curt Sampson
- Re: [tlug] STM (was: Re: work times & accommodation @tokyo)
- From: Stephen J. Turnbull
- Re: [tlug] STM (was: Re: work times & accommodation @tokyo)
- From: Curt Sampson
Home | Main Index | Thread Index
- Prev by Date: Re: [tlug] STM (was: Re: work times & accommodation @tokyo)
- Next by Date: Re: [tlug] STM (was: Re: work times & accommodation @tokyo)
- Previous by thread: Re: [tlug] STM (was: Re: work times & accommodation @tokyo)
- Next by thread: Re: [tlug] STM (was: Re: work times & accommodation @tokyo)
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links