<br><br><div class="gmail_quote">On Mon, Jul 26, 2010 at 14:43, Matthew Flatt <span dir="ltr">&lt;<a href="mailto:mflatt@cs.utah.edu">mflatt@cs.utah.edu</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

<div class="im">At Mon, 26 Jul 2010 14:29:57 +0200, Laurent wrote:<br>
&gt; The reader cannot read #&lt;path:....&gt; forms (is this the right term?).<br>
&gt; When the interaction window is in constructor mode, for (build-path &quot;a&quot;<br>
&gt; &quot;b&quot;), it writes #&lt;path:a/b&gt;, but this cannot be read back.<br>
&gt;<br>
&gt; First question: would it be possible to make the reader read paths?<br>
<br>
</div>The reason that paths are not `read&#39;able is that&#39;s there is not a<br>
single right choice for how to marshal paths:<br>
<br>
 * Sometimes you want the string form of a path, which may be encoded<br>
   in different ways on different platforms (e.g., using different<br>
   locales) to keep the string form the same.<br>
<br>
 * Sometimes you want the bytes form of a path, because the path isn&#39;t<br>
   going to be used on multiple systems, and converting to a string<br>
   form may lose information (e.g., because it&#39;s not a UTF-8 encoding).<br>
<br>
Since there was no right answer, we decided not to pick either of them.<br>
The lack of a `read&#39;able form is a weak hint to programmers that they<br>
need to look closely at the question.<br></blockquote><div><br>Thanks, I understand.<br>Maybe we could distinguish between `read&#39;able and un`read&#39;able paths?<br> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">


<div class="im"><br>
&gt; Second question: I need this for my own purposes, so I wrote a<br>
&gt; path-constructor:<br>
&gt; (define/provide (write-path p)<br>
&gt;   (cons &#39;build-path<br>
&gt;         (map (ë(p-elt)(if (symbol? p-elt)<br>
&gt;                           (list &#39;quote p-elt)<br>
&gt;                           (path-&gt;string p-elt)))<br>
&gt;              (explode-path p))))<br>
&gt;<br>
&gt; &gt; (write-path (build-path &#39;same &#39;up &quot;a&quot; &quot;b&quot;))<br>
&gt; &#39;(build-path &#39;same &#39;up &quot;a&quot; &quot;b&quot;)<br>
&gt;<br>
&gt; Does someone know if this is good enough, or am I omitting something<br>
&gt; (platform specific maybe)?<br>
<br>
</div>As a minimum, use `path-element-&gt;string&#39; instead of `path-&gt;string&#39;.<br>
<br>
Otherwise, beware that (as noted above) not all paths have string<br>
encodings; depending on your application, that may not be an issue. Or<br>
it may be that you want to marshal via byte strings using `bytes-&gt;path&#39;<br>
as a constructor.<br></blockquote><div><br>Thanks a lot Matthew! <br></div></div><br>