I was reading Armstrong's [review of Elixir][1] and I thought this paragraph was interesting, given our recent discussions about backwards compatibility in Rust. Basically he argues for tagging code with the version of the language it is targeting. I think this is a good idea too, though I don't know how helpful it is. The only language I knew of that took this approach was XSLT, but I guess Erlang does too. It'd be interesting to know how helpful it is for migrating and so forth.
``` XML files always start <?xml version="1.0"?> This is great. Reading the first line of an XML file is like listening to the opening bars of Rachmaninoff’s third piano concerto. A sublime experience. All praise to the XML designers, hallowed be their names, give these guys some Turing prizes. Putting the language version in all source files is essential. Why is this? Early Erlang did not have list comprehensions. Suppose that we give a modern Erlang module to an old Erlang compiler and ask it to compile it. The modern code has list comprehensions, but the old compiler doesn’t know about list comprehensions so the old compiler thinks this is a syntax error. If a version3 Erlang compiler is given a file that starts: -version(5,0). Then it should say ** auuuuugggghhhhhh ** Oh bother and blast, I am mere version 3 compiler and cannot see into the future. You have given me a version 5 program. This means my time on earth has come. You will have to kill me. You will uninstall me, and install a version five compiler. I will be no more. I will cease to exist. Goodbye old friend. I have a headache. I'm going to have a rest... ** It’s the first law of data design: All data that might change in the future should be tagged with a version number. and a module is data. ``` Niko [1] http://joearms.github.io/2013/05/31/a-week-with-elixir.html _______________________________________________ Rust-dev mailing list [email protected] https://mail.mozilla.org/listinfo/rust-dev
