Haskell's effect on my C++ : exploit the type system
vallettaventures.com
Haskell's effect on my C++ : exploit the type system
1–10 of 57 posts
Re: Haskell's effect on my C++ : exploit the type system
#2struct Rectangle { double x,y, width, length; };
int main() { Rectangle r = {0., 0., 10., 10. }; return 0; }
This even compiles in C++03. If you really insist on private members, you will need initializer lists and some changed member names.
The small example error has been worked around with for years by simply placing the constant on the left side of the comparison. Not pretty, but effective.
I agree with the general point, though. A functional style can make C++ much more efficient. It is also the only way to do template meta-programming and everybody who tries to go into that direction can benefit from learning Haskell.
Re: Haskell's effect on my C++ : exploit the type system
#3If your only example to show C++ verbosity fails to compile and is also patently wrong, you are not making a good point. (The constructor is private, the variable naming prevents short accessors such as Rectangle::width()). Better: struct Rectangle { double x,y, width, length; }; int main() { Rectangle r = {0., 0., 10., 10. }; return 0; } This even compiles in C++03. If you really insist on private members, you will…
Re: Haskell's effect on my C++ : exploit the type system
#4If your only example to show C++ verbosity fails to compile and is also patently wrong, you are not making a good point. (The constructor is private, the variable naming prevents short accessors such as Rectangle::width()). Better: struct Rectangle { double x,y, width, length; }; int main() { Rectangle r = {0., 0., 10., 10. }; return 0; } This even compiles in C++03. If you really insist on private members, you will…
bookmarked: http://bartoszmilewski.com/2011/07/11/monads-in-c/ http://bartoszmilewski.com/2010/11/29/understanding-c-concep...
Re: Haskell's effect on my C++ : exploit the type system
#5 > Although the newcomer C# was only introduced ten years
> ago, there is little in the language to reflect the
> thirty years of research into programming languages since
> C++ was introduced.
Not a huge fan of C#, but he couldn't have picked a worse example for language stagnation.Re: Haskell's effect on my C++ : exploit the type system
#6Re: Haskell's effect on my C++ : exploit the type system
#7Re: Haskell's effect on my C++ : exploit the type system
#8Re: Haskell's effect on my C++ : exploit the type system
#9Re: Haskell's effect on my C++ : exploit the type system
#10> Although the newcomer C# was only introduced ten years > ago, there is little in the language to reflect the > thirty years of research into programming languages since > C++ was introduced. Not a huge fan of C#, but he couldn't have picked a worse example for language stagnation .