Mailing List Archive


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

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



Curt Sampson writes:
 > On 2008-07-30 10:06 +0900 (Wed), Stephen J. Turnbull wrote:
 > 
 > > Make it a separate class, with private members for the value and the
 > > log.
 > 
 > I guess that this is the part I'm not clear on.

I'm not, either.  Clearly what needs to be done is to create an
AtomicSequence type, which has access to and validates the log(s)
before it exits.  I don't have time to deal with figuring how this
might be done, unfortunately, let alone whether it would succeed.  The
sketch in "Beautiful Concurrency" is nowhere near as detailed as I
remembered it, and I was confusing the implementation of 'atomically'
with that of the 'TVar' itself.

 > >  > 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.
 > 
 > What's the difference?

Oh, brain fart, I guess.  I was thinking that you might read or write
variables in such a way that there's no external effect, but of course
Haskell doesn't really have variables in that sense.  Anything that
resembles a C variable will be I/O in Haskell.

 > Well, at least that moves C++ into the "it's theoretically possible"
 > category. However, it's starting to sound as if "the C++ typechecker can
 > do anything Haskell's can do" is like "6502 assembler can do anything
 > that Java can do, because they're both Turing-complete."

Yes, of course.  But sometimes it's worth doing it.  Eg, in the XEmacs
case, we have strong reasons to stick with the existing C code base.
However, we don't need parts of C that can't be used in C++, so our C
code is expected to compile and run correctly as C++.  The integer
vs. character distinction is very important to our implementation of
Mule (multilingual processing), so it was worth creating a character
type that can't mix with integers without an explicit conversion.

This didn't catch absolutely everything, but Mule code is at such a
low level there's not much you can do but abort if you see char/int
confusion.  In itself it's deadly enough that we nicknamed it "Ebola".
The C++ version of characters saved a lot of runtime aborts.


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links