<story><title>Writing Python inside Rust</title><url>https://blog.m-ou.se/writing-python-inside-rust-1/</url></story><parent_chain></parent_chain><comment><author>6gvONxR4sf7o</author><text>I know this project may just be for fun, but with WASM targets for all sorts of languages, I&amp;#x27;m hoping we get to a future where mixing and matching different languages for different parts of your program will be seamless. Imagine starting a project in an easy language, then migrating pieces to a faster &amp;quot;bare metal&amp;quot; language as needed in a super piecemeal way. Same with moving pieces to a safer language as the project grows, slowly expanding the boundaries of the safe bits as appropriate.</text></comment>
<story><title>Writing Python inside Rust</title><url>https://blog.m-ou.se/writing-python-inside-rust-1/</url></story><parent_chain></parent_chain><comment><author>marvy</author><text>So, at first I thought this approach is doomed, because you lose comments, and what looks like a comment to Rust may not look like one to Python.  Example:&lt;p&gt;&lt;pre&gt;&lt;code&gt;  x = y &amp;#x2F;&amp;#x2F; 2 # floor division
&lt;/code&gt;&lt;/pre&gt;
But then I decided to look at the docs:&lt;p&gt;&lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;doc.rust-lang.org&amp;#x2F;proc_macro&amp;#x2F;struct.Span.html&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;doc.rust-lang.org&amp;#x2F;proc_macro&amp;#x2F;struct.Span.html&lt;/a&gt;&lt;p&gt;And I noticed source_text, which &amp;quot;preserves the original source code, including spaces and comments&amp;quot;!!!&lt;p&gt;Why not just use this from the start then??  Seems like the easy way out, no?&lt;p&gt;(Disclaimer: I don&amp;#x27;t know Rust, can&amp;#x27;t even write hello world.)</text></comment>