[MLton-devel] Re: finalization in MLton

Ken Friis Larsen kfl@it.edu
18 May 2003 09:53:19 +0100


--=-=-=

Hi Stephen,

Sorry for not giving you any feedback on the progress of the mGTK
port.  The sad reason is that progress has been slow.  Not due to
technical problems, but due to lack of time.

The good news is that I think I've figured out how to solve all
pressing problem.  So now all what is left is A Simple Matter Of
Programming.



> I just checked in an attempt at implementing finalization in MLton.

Arg.  This is the only thing I have found time to implement.  I've
attached my attempt together with a test example.

The example works with mlton-20030419 but if I try to use yesterdays
CVS mlton, then MLton spews tons of SSA SML at me and ends with:
      unhandled exception: TypeError

But yesterdays CVS mlton works better for me on one of my other
programs.  Where mlton-20030419 ends the compilation with:
      shrinker raised Prim.apply raised assertion failure: SmallIntInf.fromWord

This reminds me to ask:  How do you prefer bug reports?  In the SF bug
tracker, or as mail to MLton@mlton.org?  (And which will give me the
quickest feedback ;-)

Getting back to the mGTK port.  I have a hack-and-slash implementation
of the Callback interface I talked about last time:

signature Callback =
sig
    eqtype id
    
(*  val register     : 'a -> id
*)
    val register     : (int -> int) -> id
    val unregister   : id -> unit
    val isRegistered : id -> bool
end

If you want it I can send you my implementation together with test
program.


I can see that I won't have a lot of time the next two weeks to work
on the port.  Because I'll spend almost all my time on porting an
other SML/C library to MLton.  And for this other library I need
finalization as well :-)

> The new structure is MLton.Finalizable, which has the following
> signature.
> 
> signature MLTON_FINALIZABLE =
>    sig
>       type 'a t
> 
>       val addFinalizer: 'a t * ('a -> unit) -> unit
>       val finalizeBefore: 'a t * 'b t -> unit
>       val new: 'a -> 'a t
>       val withValue: 'a t * ('a -> 'b) -> 'b
>    end

I'm happy to see that our interfaces looks a lot like each other.
That must mean that we agree on the basic ideas.

> If you would like me to make an experimental release with this, let me
> know. 

I'm fine with CVS, but it would be nice to be able to compile the
example I've attached with CVS MLton ;-)


Cheers,

--Ken

--=-=-=
Content-Type: application/x-gzip
Content-Disposition: attachment; filename=finalized.tgz
Content-Transfer-Encoding: base64

H4sIAI5Dxz4AA+1ZbU/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7BN6mCO8C8UpkFX6NxphuPse3UXhBH0nTdypAhTYzBSAujufYMxL7tZgf
nBRyLSmVmCb8TyaOiXl06gwr5gdlijM2ORVvcSkYzLJkmlRmX1wK/xtmKB1yJeLft6yH1VwqCQC8
6gXx8d3ZLzTL9iQqiWRdIfm8fk9H32OjLBqKH284Veiq2jKfQuxiNkvJ6DfNpoUquOjMdMLipKzl
00KsqOHT4uGT4+PbFZvWHNZOtJT5BKGZX8jzjgu2VypgJf838nVEhKubnb3wHWDb/B82vv/G/P03
HB128/9VCMB9Xl+s/0A0AEcqj7Uprt0bF176sAFUEwDMRIhGB979jceURgyBygzQcxAB+5iHMEdo
7OEmL5a5xkfNRe+dSjDqdTrHgOz1xQ+pHdjsvc1pRfdF7/e0d+ntOgVGL5aJYtj1Sryk9cVtYvjQ
GkYJFhMapIzKVl6vEkx0PyUEJBsat5oBo5Kv+2RfEBRgy5D/yNozXiVLNwwt7Cyhl2T8+oQaHosx
lZgaQQsZdmIYegUAzwQapXypNdHc8YMKPIvIYp7vmWxva3y+LED7UfjKMRItOilGrE7o4/cpUb+0
/XNXwGfJ12Kq7xD3QCyyqRjCrzAgO0Q7WUQUPnyJpRTBInOizCSn7vncYZ2lm4kklVdQ57tI9t5z
NhGz6tCTogP8oLHkmH/K6BeCYr8t08r2ZqU0AkU5edrYSlUjzc3c+olK5/i+T0xQdmxbzu37LjDh
ptZnDm2GfPv3a0dfRq35f7BI6CMiXvy3Z2yZ/9g8pvk/OgyPxuMRnqPDUdjN/1eheZ6tlvQZfN78
R4Bo/SwkHl0Su7bsqKOOOuqoo4466qijjjrqqKOvif4BDyT5lQAoAAA=
--=-=-=--


-------------------------------------------------------
This SF.net email is sponsored by: If flattening out C++ or Java
code to make your application fit in a relational database is painful, 
don't do it! Check out ObjectStore. Now part of Progress Software.
http://www.objectstore.net/sourceforge
_______________________________________________
MLton-devel mailing list
MLton-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mlton-devel