4 ms·
>Can you provide an example where static typing slows you down compared to dynamic typing? I spend an annoying amount of time trying to compare/add/multiply...
by mrep 8y ago
>Can you provide an example where static typing slows you down compared to dynamic typing?
I spend an annoying amount of time trying to compare/add/multiply... different types in C++ like time, durations, dates, ints, floats in my day job.
> And I can't imagine this extra operation being a significant drag.
If you have an open source C++ web framework that you think is comparable in features to python django or ruby on rails, I would be very interested as I do want the performance improvements but all the ones I have looked at look like way more work to implement what I want than using django/RoR.
- int_19h 8y ago> I spend an annoying amount of time trying to compare/add/multiply... different types in C++ like time, durations, dates, ints, floats in my day job. Multiplying ints and floats "just works" in C (although you have to mind overflow, but that's not a type issues). Other examples don't make a lot of sense. E.g. why would you need to multiply time by duration, or compare one with the other? They're different quantities, reflected as such in the type system. That it won't let you do something like that is the whole point - it would be a bug if it did (and if not, then the data types were chosen wrongly). OTOH, adding a duration to a date is semantically meaningful - which is why std::chrono has operator+ overloaded for various combinations of time_point and duration.
- mrep 8y ago> and if not, the data types were chosen wrongly That is kind of my point. When I use C++ in my day job, there are highly optimized libraries/classes which makes sense considering the amount of work that needs to be done. However, if I am just trying to do some quick data analysis and the data set is small, I just want to do some quick math on some basic data and not have to write code to convert between every single type under the sun. With dynamic types, I can quickly convert data between dictionaries, sets, lists and what not and run it extremely quickly. That is much quicker than trying to compile and run code to transform data into the results I am trying to create.
- DenisM 8y agoC++ no, C# yes: ASP.NET MVC is pretty good.