News for hackers. Stuff that matters.
Re:Types Are Moving to the Right by mehrdadn on Saturday March 16, 2019 @08:37PM (#19411403)
Easier for the machine means easier for people to write tooling for the language. Imagine if you could ast.parse() C++ code the same way you could for Python code.
Re:Types Are Moving to the Right by jcelerier on Sunday March 17, 2019 @06:55AM (#19413366)
ast.parse() in c++ is just a matter of including libclang.h
Re:Types Are Moving to the Right by tigershark on Saturday March 16, 2019 @08:41PM (#19411415)
You can easily parse c# or f# that are probably more complex than C++, so maybe it’s not so impossible?
Re:Types Are Moving to the Right by Gladdyu on Saturday March 16, 2019 @08:46PM (#19411432)
I doubt those are more complex to parse than C++, as C++ parsing is undecidable.

http://blog.reverberate.org/2013/08/parsing-c-is-literally-u...

Re:Types Are Moving to the Right by mehrdadn on Saturday March 16, 2019 @09:04PM (#19411490)
There's something that's unsatisfying about most of these examples which is that a sane person wouldn't write code that multiplies two objects and throws away the result, so people might think that if you added extra constraints to prevent depending on silly side effects, the issue would go away. This is definitely false, but it's not exactly obvious if you don't think about it too hard... I wish people actually paid attention to it when constructing counterexamples.

So, for anyone else feeling similarly unsatisfied, here's another example that might be more satisfying in that respect:

  y = f(g<T, U>(x));
In conjunction with the fact that templates are already Turing-complete, we can see that detecting whether this is a call to a templated g or two comparisons is a Turing-complete question.

Also notice a similar parsing issue arises in C# as well, but I don't think generics there can be used to perform Turing-complete computation... though not sure.

Re:Types Are Moving to the Right by ygra on Sunday March 17, 2019 @04:57AM (#19412994)
You can use generics and overload resolution to solve satisfiability problems in C# and Java. But not in the way like templates in C++ allow for compile-time computation.
Re:Types Are Moving to the Right by mehrdadn on Sunday March 17, 2019 @05:01AM (#19413000)
Yup I've seen that aspect haha.
Re:Types Are Moving to the Right by tigershark on Saturday March 16, 2019 @08:57PM (#19411474)
C# compiler can generate a huge amount of code from simple and small programs: https://mattwarren.org/2017/11/08/A-DoS-Attack-against-the-C...

But you can very easily get the AST. Obviously it may happen that you have to wait until the hell is frozen to get a result, but generally it doesn’t happen in code that you see day to day..

Re:Types Are Moving to the Right by mehrdadn on Saturday March 16, 2019 @08:46PM (#19411437)
I didn't say it was impossible.
Re:Types Are Moving to the Right by tigershark on Saturday March 16, 2019 @08:58PM (#19411475)
Sorry, also I didn’t mean impossible, the right word is probably unpractical...
Re:Types Are Moving to the Right by mehrdadn on Saturday March 16, 2019 @09:12PM (#19411516)
Well I don't think C++ parsing is easier than C# parsing either.