4 ms·
> On the contrary, having the compiler worry about correct resource management frees you to concentrate on other things. It's a hindrance when you're trying to
by berkut 10y ago
> On the contrary, having the compiler worry about correct resource management frees you to concentrate on other things.
It's a hindrance when you're trying to prototype things to see if something's even worth while.
- catnaroek 10y ago> It's a hindrance when you're trying to prototype things to see if something's even worth while. I don't see the value in deliberately writing software of non-optimal quality. Bugs can happen to anyone, but I take issue with not aiming for excellence.
- berkut 10y agoTo see if an algorithm is viable for example. Obviously if you write code for a prototype that has several limitations (say it's single-threaded) in order to determine if a new algorithm provides the correct result, you probably don't want to be concerned at this stage with complete safety if you can run it for the prototype in single threaded mode and probably not have any issues. That might allow you to make a decision as to whether to continue down that path quicker than having to write a more robust solution and then realise it doesn't actually work with certain input data or something.
- catnaroek 10y ago> To see if an algorithm is viable for example. C++ isn't exactly the first language I would pick to test the viability of an algorithm. Too much ceremony, distracting me from the essence of the algorithm. ML seems more up to the task.
- coldtea 10y agoThat's viable only if you're writing the algorithm for academic fun. If you want to check its specific runtime behavior and speed with C++, for incorporation into a program, then you can't just use ML or Python etc.
- catnaroek 10y agoMLton comes within a factor of 1.5 or 2 of C and C++'s runtime speed, at the price of requiring whole-program compilation and having long compilation times. (Not that C++'s compilation times are blazing fast either.) The implementation of a single algorithm is hardly ever big enough a project for long compilation times to become a serious problem, so this seems like an acceptable tradeoff to me.
- berkut 10y agoHow do you then give say 20GB of test production data in a packed structure to ML? Re-write thousands of lines of C++ infrastructure into another language just to test it in this "theoretical" language? Or re-use the existing code and write a slightly hacky prototype within the code which can close to effortlessly run any data the program creates/accepts. I know which one I'd pick.
- todd8 10y agoI got curious a year or so ago about writing a program to play freecell solitaire. I looked around first and there were a few programs out there with open source, but they were thousands of lines of C code. I was able to write a program that worked as well as these, but it only took 200 lines of python or so. This allowed me to experiment with my algorithms and data structures so easily that I was happy with it in a couple of days. If I was going to market such a program the next step would be to rewrite this in Java, C++, or Go (even Rust once I learn it). I'm not interested in marketing a freecell game, so I will rewrite it only for fun, someday. I got started on the program because my wife is twice as fast as I am at that game (and every other game not requiring shooting or math); I thought well at least I'm a better programmer than her (for now, she hasn't tried that yet!) so I'll write a program to play freecell.
- nostrademons 10y agoThat's true but people who are prototyping would rarely work with C++ or Rust anyway. Write it in Python, Ruby, or Javascript, all of which have memory safety but pay for it at runtime.