Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tlug] STM (was: Re: work times & accommodation @tokyo)



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.

> I assume that Java has some kind of templating facility.

I think if you're not even sure about that, you might want to learn a
bit more about Java before you start disputing my claim. But I'm easy;
let's replace Java with another language of your choice, if you like,
and restart the argument.

> So all you need to do is define a TVar template
> class that does not derive from the underlying class, but contains a
> private (reference to an ?) instance of it.  For the locking, I guess
> resource acquisition as initialization would be powerful enough.

This would be the argument from arm-waving? :-)

And how do you set things up so that you can combine the usage of two
or more of these classes and they'll do the right thing or the compiler
will tell you that they won't? Section 2.1 of the Beautiful Concurrency
paper[1] is a good description of a problem I believe Java cannot type
check.

[1]: http://research.microsoft.com/~simonpj/Papers/stm/beautiful.pdf

> Of course you still need to decide which variables need
> 
>  > and thus you're still open to the bugs that the Haskell compiler
>  > will prevent you from inserting when you start combining smaller
>  > operations.
> 
> I don't see how.

Ah, and now the argument from lack of understanding. :-)

The really short explanation is that Haskell forces you to distinguish
pure and impure operations, and type your impure operations. The longer
explanation would require some study on your part, most likely, and this
is not the place for a long tutorial paper on the Haskell type system,
monads, and so on anyway.

Let's just say right now you're in the situation where someone not
familiar with OO is saying, "I don't see what it offers," but worse,
since this is based on some formally proven mathmatical theories.

But there are lots of resources on the Internet to help you learn just
why this is the case; haskell.org is one good place to start.

cjs
-- 
Curt Sampson       <cjs@example.com>        +81 90 7737 2974   
Mobile sites and software consulting: http://www.starling-software.com


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links