<div dir="ltr"><div>I've been rethinking these primitives after the discussion at the last hangout, and have come up with a different set altogether. Can you see a simpler or more elegant approach to the one described below?<br><br></div><div>Here is the new approach I am considering:<br><br></div><div>4 copying primitives in the source language going from string/bytearray to string/bytearray.<br></div><div>The source comes with an offset and a length to copy.<br></div><div>If the destination is a string, a new string is created. If the destination is a bytearray, it must be provided.<br><br></div><div>Concatenation (of lists of strings/arrays) and conversions between (whole) strings and (whole) bytearrays can be implemented in the basis library in terms of these primitives. And the primitives should be efficiently implementable in terms of a byte-based memcpy primitive further down. (There will need to be bounds checking in the source-level semantics (i.e., Subscript exception can be raised), and this will sometimes be unfortunate (i.e., when obviously in bounds), but I don't think this is too costly.)<br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 14 March 2017 at 16:52, Ramana Kumar <span dir="ltr"><<a href="mailto:Ramana.Kumar@cl.cam.ac.uk" target="_blank">Ramana.Kumar@cl.cam.ac.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi all,<br>
<br>
I've started adding string/bytearray conversion and concatenation<br>
primitives (issues 244 and 245). Before getting too deep into updating<br>
the compiler etc., may I request a review of the semantics? Here they<br>
are:<br>
<br>
<a href="https://github.com/CakeML/cakeml/commit/67dd15bbd03f516be618ba72f1d56a2764209263" rel="noreferrer" target="_blank">https://github.com/CakeML/<wbr>cakeml/commit/<wbr>67dd15bbd03f516be618ba72f1d56a<wbr>2764209263</a><br>
<br>
I noticed that v_to_char_list might be better as vs_to_char_list, to<br>
be run after v_to_list (rather than duplicating its<br>
list-deconstruction functionality). But I leave such refactoring for<br>
another time.<br>
<br>
Cheers,<br>
Ramana<br>
</blockquote></div><br></div>