News for hackers. Stuff that matters.
Re:Yes, Python is Slow, and I Don’t Care by hellofunk on Friday September 08, 2017 @10:32AM (#15200424)
Cool, but I don't know much about Ada, and would like to see an example for a statically-typed "range checker" in a more mainstream language used actively today. C++ templates can do a lot of magical stuff at compile time but such techniques are well beyond the reach of most developers.

I can't think of any typed language I've used or seen in active modern professional work where you could validate a value as part of a type at compile time.

Re:Yes, Python is Slow, and I Don’t Care by Too on Saturday September 09, 2017 @12:00PM (#15207659)
C# with "code contracts" allows you to annotate function arguments with valid ranges which will be statically checked at compile time. It's quite verbose though.

https://docs.microsoft.com/en-us/dotnet/framework/debug-trac...

Re:Yes, Python is Slow, and I Don’t Care by Jtsummers on Friday September 08, 2017 @10:42AM (#15200505)
Not without extra-compiler tooling like other static analysis tools, you're probably correct. I haven't had a chance to use much Ada, it's always been a pleasure for me to work in because I get to use things like the above to make my code so much clearer.
Re:Yes, Python is Slow, and I Don’t Care by Someone on Friday September 08, 2017 @12:43PM (#15201756)
I think you can get quite far in C++ with a class that has a constexpr constructor taking a double that checks for range, and (quite a few) operator overloads that allow one to do the normal operations on such quantities.
Re:Yes, Python is Slow, and I Don’t Care by mark-r on Friday September 08, 2017 @12:29PM (#15201617)
Pascal has integer range types, but Pascal hasn't been mainstream for a long time now.