Yeah, realized after I sent it that you probably did that on purpose... On Mon, Jun 9, 2014 at 7:19 PM, Tom Rokicki <rokicki@gmail.com> wrote:
Yes, I know about the auto keyword---it's the most fundamental form of type inferencing, added precisely because of this issue.
Also, I do know that they fixed the "> >" issue as well.
I was responding to Warren and James saying just declare the types or have the tools insert the types---neither approach I agree with.
On Mon, Jun 9, 2014 at 4:10 PM, Michael Kleber <michael.kleber@gmail.com> wrote:
You need to get with C++11, Tom.
std::map<std::pair<int, long>, std::vector<double>> costBasis; // No need for a space in the closing ">>" for (auto it=costBasis.begin(); it != costBasis.end(); it++) {...} // Type inference in C++
--Michael
On Mon, Jun 9, 2014 at 5:46 PM, Tom Rokicki <rokicki@gmail.com> wrote:
The problem is sometimes the types are a pain.
Take C++. Occasionally you need things such as:
std::map<std::pair<int, long>, std::vector<double> > costBasis ; for (std::map<std::pair<int, long>, std::vector<double> >::iterator it=costBasis.begin(); it != costBasis.end(); it++) { }
Typedefs help but also clutter the namespace.
Conciseness in code is rewarded in many ways. Type inferencing is a good way to avoid repeating yourself just to pacify the compiler.
On Mon, Jun 9, 2014 at 2:25 PM, James Propp <jamespropp@gmail.com> wrote:
Maybe what we need is intelligent code-editing software that inserts declarations as needed and queries the coder in cases where it's not able to deduce the coder's intent. It should be tuneable, like autocorrect features for text-editors.
Or do modern code-editors already include such features? (Is it time to stop writing my C code in vi?)
Jim
On Monday, June 9, 2014, Warren D Smith <warren.wds@gmail.com> wrote:
Well, what is wrong with just declaring the types of all the variables, dammit?
Sure, maybe many of the types could be "deduced" without you declaring them, but I think forcing you to declare them clarifies thinking and makes the code easier to understand when reading it, at little cost, so this is a feature not a bug. It is like the "cast of characters" at the beginning of the script of a play. Sure, you could deduce it. Hah.
And if it is really turing undecidable, then at least sometimes, it is damned hard to make the deductions, proving the necessity of My Way.
_______________________________________________ math-fun mailing list math-fun@mailman.xmission.com <javascript:;> https://mailman.xmission.com/cgi-bin/mailman/listinfo/math-fun
_______________________________________________ math-fun mailing list math-fun@mailman.xmission.com https://mailman.xmission.com/cgi-bin/mailman/listinfo/math-fun
-- -- http://cube20.org/ -- http://golly.sf.net/ --
_______________________________________________ math-fun mailing list math-fun@mailman.xmission.com https://mailman.xmission.com/cgi-bin/mailman/listinfo/math-fun
-- Forewarned is worth an octopus in the bush. _______________________________________________ math-fun mailing list math-fun@mailman.xmission.com https://mailman.xmission.com/cgi-bin/mailman/listinfo/math-fun
-- -- http://cube20.org/ -- http://golly.sf.net/ --
_______________________________________________ math-fun mailing list math-fun@mailman.xmission.com https://mailman.xmission.com/cgi-bin/mailman/listinfo/math-fun
-- Forewarned is worth an octopus in the bush.