Re: [Boost-users] Python 'in' keyword-like in C++
What do people think of actually including things like this in code? In terms of maintenance and readability, is it a good idea to create so many different ways of doing things? Purely thinking from the POV that, I find a library I want to modify to support some new thing, and I find it is full of unusual styles and obfuscated custom techniques. I'm not knocking boost or the stl, just wondering if things like trying to recreate python styles in C++ are a step too far, a sort of "what is wrong with the C++ style?" question. No flames, I'm _not_ telling anybody they are 'wrong' :) Gaz
Foster Gareth wrote:
What do people think of actually including things like this in code? In terms of maintenance and readability, is it a good idea to create so many different ways of doing things? Purely thinking from the POV that, I find a library I want to modify to support some new thing, and I find it is full of unusual styles and obfuscated custom techniques.
I'm not knocking boost or the stl, just wondering if things like trying to recreate python styles in C++ are a step too far, a sort of "what is wrong with the C++ style?" question. No flames, I'm _not_ telling anybody they are 'wrong' :)
Gaz
I'm just amazed that C++ _can_ support something pretty close to python style completely within the language. I can see something like this could be rather useful. How many of you have thought: "I wish I could just make my OWN bloody operator!". In any other language (apart from Haskell) you would just have to put up with whatever syntax the language thinks you should use, but C++, ohh no, put enough effort into it and you can get Lisp :D. Well... Ok, that's a lie. C++ _does_ have limits (most are just sytactic), but it is incredibly flexible. Thanks for that <op> idea, btw, I really think someone who /knows/ how to write libraries could have some fun with this one. Anyone want to jump in? BTW, the version I posted can't handle literals, just put in some overloads of (LhsT const&, ...) and (RhsT const&, ...)
Simon Buchan wrote:
In any other language (apart from Haskell)
And python ;) http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/384122 Daniel
participants (3)
-
Daniel James
-
Foster Gareth
-
Simon Buchan