Re: Evaluating functor application only once

Matthew Fluet <[email protected]> Thu, 4 Apr 2019 06:15:51 -0400
Newsgroups gmane.comp.lang.ml.mlton.user
Message-ID <CAMrhFL66UhkckcoPpVX-szLHgk0Z+KZ7xAuOgvx3aKaewF4ArA@mail.gmail.com>
--===============6494844757702455990==
Content-Type: multipart/alternative; boundary="00000000000044fcfe0585b1a8ef"

--00000000000044fcfe0585b1a8ef
Content-Type: text/plain; charset="UTF-8"

On Thu, Apr 4, 2019 at 3:18 AM Phil Clayton <[email protected]> wrote:

> In the absence of applicative functors, I am trying to ensure that
> certain functors are applied only once.  (Without going into too much
> detail, the issue is that a library that needs e.g.
>    structure GUInt8Array = CArray(GUInt8)
> can't know whether another library has already introduced the same
> structure.)
>
> My approach is to have the functor application in its own SML file:
>
>    <Name>.sml
>      structure <Name> = F(X)
>
> With Poly/ML, which doesn't support MLB files, I can have a variant of
> "use" that only processes a file <Name>.sml if there is no existing
> structure <Name>.
>
> With MLB files, I plan to also introduce <Name>.mlb (which contains only
> <Name>.sml) and refer to that, so that it won't have any effect if
> another library has already evaluated <Name>.mlb.  What I am doing is
> inherently complier-specific, so I wondered - is there is any other
> MLton-specific way of achieving the same thing, e.g. MLB extension?


No.  Your plan to use <Name>.mlb would be my suggestion; the semantics of
MLB files to evaluate a <file>.mlb exactly once is precisely to support
this style of "one definition".

-- 
You received this message because you are subscribed to the Google Groups "MLton-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

--00000000000044fcfe0585b1a8ef
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr"><div class=3D"gmail_default" style=3D"fon=
t-family:courier new,monospace;font-size:large"><span style=3D"font-family:=
Arial,Helvetica,sans-serif;font-size:small">On Thu, Apr 4, 2019 at 3:18 AM =
Phil Clayton &lt;<a href=3D"mailto:[email protected]">phil.clayton@ve=
onix.com</a>&gt; wrote:</span><br></div></div><div class=3D"gmail_quote"><b=
lockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-le=
ft:1px solid rgb(204,204,204);padding-left:1ex">In the absence of applicati=
ve functors, I am trying to ensure that <br>
certain functors are applied only once.=C2=A0 (Without going into too much =
<br>
detail, the issue is that a library that needs e.g.<br>
=C2=A0 =C2=A0structure GUInt8Array =3D CArray(GUInt8)<br>
can&#39;t know whether another library has already introduced the same <br>
structure.)<br>
<br>
My approach is to have the functor application in its own SML file:<br>
<br>
=C2=A0 =C2=A0&lt;Name&gt;.sml<br>
=C2=A0 =C2=A0 =C2=A0structure &lt;Name&gt; =3D F(X)<br>
<br>
With Poly/ML, which doesn&#39;t support MLB files, I can have a variant of =
<br>
&quot;use&quot; that only processes a file &lt;Name&gt;.sml if there is no =
existing <br>
structure &lt;Name&gt;.<br>
<br>
With MLB files, I plan to also introduce &lt;Name&gt;.mlb (which contains o=
nly <br>
&lt;Name&gt;.sml) and refer to that, so that it won&#39;t have any effect i=
f <br>
another library has already evaluated &lt;Name&gt;.mlb.=C2=A0 What I am doi=
ng is <br>
inherently complier-specific, so I wondered - is there is any other <br>
MLton-specific way of achieving the same thing, e.g. MLB extension?</blockq=
uote><div><br></div><div class=3D"gmail_default" style=3D"font-family:&quot=
;courier new&quot;,monospace;font-size:large">No.=C2=A0 Your plan to use &l=
t;Name&gt;.mlb would be my suggestion; the semantics of MLB files to evalua=
te a &lt;file&gt;.mlb exactly once is precisely to support this style of &q=
uot;one definition&quot;.</div><div class=3D"gmail_default" style=3D"font-f=
amily:&quot;courier new&quot;,monospace;font-size:large"></div></div></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;MLton-user&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:[email protected]">mlton-user+unsu=
[email protected]</a>.<br />

--00000000000044fcfe0585b1a8ef--


--===============6494844757702455990==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline


--===============6494844757702455990==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
MLton-user mailing list
[email protected]; [email protected]
https://lists.sourceforge.net/lists/listinfo/mlton-user

--===============6494844757702455990==--