3 ms·
Quick, name a language where I can do something simple like mention "Whenever this function is called, make sure there is enough free memory (at least ---- MB)
by prymitive 10y ago
Quick, name a language where I can do something simple like mention "Whenever this function is called, make sure there is enough free memory (at least ---- MB) before actually calling it; if there isn't, first swap out any objects from memory to disk, starting with the ones that had been used the longest time ago, and after the function has finished running, swap those back into memory."
Why would you need a language for that? Isn't memory management what a kernel will do for you, including this specific scenario (the swap back to memory part will be done if pages are needed in memory)?
- logicallee 10y agoWhy would you need any new language? Likely anything you would want has been done in some language already. I was simply giving an example of something simple and well-specified that isn't being done. - In response to the other comment (sorry this is breaking the comment ordering, but I am going to sleep soon and triggered some submitting too much message): >And you know, the best way to get to the future is to invent the future ... Nobody is going to accuse you of being an idea man/woman if you just stand around and wait. (My original comment was downvoted to -3, though this surprised me). Meanwhile I can pick my battles (what to invent) carefully, away from the dumb as a sack of rocks status quo. Which I was just reporting a part of. Don't shoot the messenger. (But also, as a practical matter, this story is about how syntax is the last thing you should design - which I kind of disagree with.) - I also wish I had added in parentheses (in my original comment) after "pictographic symbols", the words "(or evocative post-modern landscapes that have meaning only to you, the language designer, with a brief sentence underneath each one, of the type that if you were to ever revisit it or have to explain it to anyone else you could)" in parentheses, though now that I see the backlash against my comment, it doesn't really matter. The reason I can't add those parenthetical words is because I am outside my edit window.
- webmaven 10y ago> I was simply giving an example of something simple and well-specified that isn't being done. But as has been explained elsewhere in this thread, it is being done, but either by the OS or the VM, rather than as part of the language semantics. Improvements in the explicit handling of memory allocation are both possible and desired in programming languages (eg. Rust has some interesting memory-related syntax and semantics), but this particular suggestion of yours just isn't well thought out.
- logicallee 10y agoYou picked one of three examples I gave - it doesn't matter if they were well-thought-out, I just gave three examples of things that aren't easy in any of the languages I code in. That's because every language I code in is ALMOST the same (there are translators that translate one to the other robotically, for example) - their biggest difference is syntax. Of course they differ a lot in their functionality - but none of them have much of that to begin with, in my opinion. Today's languages are tiny and hardly do anything. In my opinion. (Check this comment in twenty years and I think you will find I was right.)