Should we have primitive fill-once variables?
Joachim Breitner
mail at joachim-breitner.de
Fri Jun 29 18:13:39 UTC 2018
Hi,
Am Freitag, den 29.06.2018, 12:54 -0400 schrieb David Feuer:
> On Friday, June 29, 2018 11:51:07 AM EDT Joachim Breitner wrote:
> > when reading the subject I was expecting something like this:
> >
> > -- | pure! but blocks until the IVar is written
> > readIVar :: IVar a -> a
> >
> > -- | tries to write to an IVar.
> > -- Succeeds if it is empty (returning True)
> > -- Does nothing if it has been written to (returning False)
> > writeIVar :: IVar a -> a -> IO Bool
>
> It really depends. Are there useful (compile-time or run-time)
> optimization for IVars (write-once) that don't apply to QVars (fill-
> once)? If so, we might indeed want to offer writeIVar as you suggest,
> and
I don’t know! Maybe the GC can treat a filled IVar differently (because
it is no longer mutable?) But really, I don't know :-)
Cheers,
Joachim
--
Joachim Breitner
mail at joachim-breitner.de
http://www.joachim-breitner.de/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20180629/1f564125/attachment.sig>
More information about the ghc-devs
mailing list