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-31 13:50 +0900 (Thu), Stephen J. Turnbull wrote:

> Curt Sampson writes:
> 
>  > It's easy to reconstruct monadic behaviour in either language. It's just
>  > very difficult or impossible to type check it.
> 
> Well, what I had in mind basically was creating closures as a type,
> then "atomically" would be a type containing a list of closures.  The
> calling syntax would be something like
> 
>     Atomically(list_of_closures).exec()

No, this doesn't appear to do it. Read section 3.2 of the Beautiful
Concurrency paper carefully and note what's going on. The STM library is
set up such that it's never possible to manipulate a TVar directly; it's
possible only to generate an action (of type "STM a"). atomically takes
an action (typically this will be the composition of several actions)
and executes them atomically.

Now how, in the system above, do you prevent Java code, inside or
outside your list of closures, from manipulating the TVars themselves,
rather than having only atomically able to execute these actions?

The only way I can see is if the closures you're passing in are not
arbitrary Java code, but are some sort of other language, or perhaps a
very limited subset of Java code, either of which you need to compile
and verify yourself.

In other words, you effectivly have to write a new language to do this.

> This would be a major PITA to code, and probably non-trivial to use,
> it's not going to be a win in terms of convenience or transparency.

There's that, too. That level of "can do it" is so far from "can do it
conveniently" that it's probably closer to "can't do it at all," when it
comes to writing real programs.

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