Robert O'Callahan wrote: > One of my pet peeves about programming languages is that they don't > go far enough in mandating a particular coding style [...]
I've been thinking about a slightly different approach to this problem, which I've written up here: http://uazu.net/notes/astlang.html Basically it is to make the language 'source code' an AST dump and then format the AST to the user's preference in the editor. This means each coder gets to see everyone else's code in their own preferred style, wrapped to their own preferred width, and so on. There is more to it, though -- see the page above. This is (partly) my solution to the 'itch' which is Java source code, where some people code with 160-column terminals, 80-column terminals, 4-space tabs, 8-space tabs, spaces present or missing in random places, and it all ends up being completely unreadable on my screen. So I'm working on a Java AST-based editor right now, so I can see the code as I want to see it (even with an alternative syntax if I want), and save back a minimal patch of conventional Java to the original source code (i.e. minimise 'git blame'). This way I can try out the ideas and see how well it can be made to work. I've got a contract in Java starting in a few months, so that is a good motivator. I'm quite fussy about wrapping long expressions with nested parens nicely so that the structure is evident (which Eclipse fails at completely), so getting the formatting good enough is a priority, although it will always be a compromise to some extent. It seems like Rust can get a lot of similar benefits if the pretty printer is good enough that people are happy to run it regularly on their code. If it is the editor that is pretty printing, they'll have no choice though (nor will I!), which is what I'm experimenting with right now. Then there is no opportunity to get precious about some particular bit of code layout, and no need to do so either if the pretty printer does a good enough job. Hopefully I can make it work. Jim -- Jim Peters (_)/=\~/_(_) [email protected] (_) /=\ ~/_ (_) UazĂș (_) /=\ ~/_ (_) http:// in Peru (_) ____ /=\ ____ ~/_ ____ (_) uazu.net _______________________________________________ Rust-dev mailing list [email protected] https://mail.mozilla.org/listinfo/rust-dev
