Show HN: Visualizing 'Silhouettes' of Programming Languages
This is fun and interesting, but I don&#x27;t think it says much about the various <i>languages</i>. Each of these languages can be formatted in a variety of styles.<p>As one example, Rust, and especially Servo, began with a recommended (or mandated) style with a heavy use of column alignment for things like function arguments. Like this code from rustfmt:<p><pre><code>    let mut rewrites = try_opt!(subexpr_list.iter()
                                            .rev()
                                            .map(|e| {
                                                rewrite_chain_expr(e,
                                                                   total_span,
                                                                   context,
                                                                   max_width,
                                                                   indent)
                                            })
                                            .collect::&lt;Option&lt;Vec&lt;_&gt;&gt;&gt;());
</code></pre>
But the Rust example in the silhouette page doesn&#x27;t follow this style at all. Instead, it uses a purely indentation-based style with little or no use of column alignment. From looking at the latest Rust coding style document, it seems that the Rust community may be moving away from this aligned style to an indented style. (Anyone who is more tuned into Rust style, feel free to set me straight.)<p>If the code above were written in an indented style it might look more like this:<p><pre><code>    let mut rewrites = try_opt!(
        subexpr_list
            .iter()
            .rev()
            .map( |e| {
                rewrite_chain_expr( e, total_span, context, max_width, indent )
            })
            .collect::&lt;Option&lt;Vec&lt;_&gt;&gt;&gt;()
    );
</code></pre>
Same language, same code, but a very different silhouette.<p>Similarly, the last time I looked at the Oculus SDK, its C++ and C# code used a column alignment style, and I think some other projects like OpenCV use column alignment too.<p>Many other C++ and C# projects eschew alignment in favor of indentation, though.<p>This kind of choice in styles is available in all the languages being compared. Yes, even in Python. The Python example uses column alignment here and there, but it would be just as &quot;Pythonic&quot; to use indentation in those places.<p>So I don&#x27;t think this is really comparing programming languages, it&#x27;s just taking a single example for each language, where other projects in the same language may have very different silhouettes.