4 ms·
It's been awkward. The reason that is from a shortener is because the program is encoded in the url. The actual URL there is http://play.rust-lang.org/?code=fn
by steveklabnik 12y ago
It's been awkward. The reason that is from a shortener is because the program is encoded in the url. The actual URL there is
http://play.rust-lang.org/?code=fn%20main%28%29%20{%0A%20%20%20%20let%20unsafe_reference%3A%20%26%28%29%20%3D%20unsafe%20{%20%3A%3Astd%3A%3Amem%3A%3Atransmute%280u%29%20}%3B%0A%20%20%20%20let%20x%20%3D%20Some%28unsafe_reference%29%3B%0A%20%20%20%20println!%28%22{}%22%2C%20x%29%0A http://play.rust-lang.org/?code=fn%20main%28%29%20{%0A%20%20...}
HN displays that kinda okay, but if you don't have it looking like HN does, it can get to be almost two thousand characters.
- TheLoneWolfling 12y agoHmm... Worst compression algorithm ever: 1) make a URL containing the data to compress (perhaps base-38 encoded or something) 2) Send it to a URL shortening service 3) store the returned link 4) use it every so often to ensure the link doesn't go dead 5) profit!
- codemac 12y agoNot only that, but HN parses the full link incorrectly (the last } isn't included in the link) such that the only way for the link to have worked is to use some indirection. Like you know, a url shortener.
- Sniffnoy 12y agoWell, you can %-escape the '}'... http://play.rust-lang.org/?code=fn%20main%28%29%20{%0A%20%20%20%20let%20unsafe_reference%3A%20%26%28%29%20%3D%20unsafe%20{%20%3A%3Astd%3A%3Amem%3A%3Atransmute%280u%29%20}%3B%0A%20%20%20%20let%20x%20%3D%20Some%28unsafe_reference%29%3B%0A%20%20%20%20println!%28%22{}%22%2C%20x%29%0A%7D http://play.rust-lang.org/?code=fn%20main%28%29%20{%0A%20%20...