4,901 karma · joined Sep 13, 2020 (6y ago) · 1,641 submissions
comment 5y ago · link · parent
Message 1
Message 2
Message 3
Will give this output: Message 3
Message 2
Message 1
Your odd/even fix also won't work, because a function may push an argument to a list, and pass the list in another argument, making the original temporary accessible from any recursion level.A call to a destructor is a normal call. If you need to call destructors, then it means your tail call is a call to a destructor and not what you're seeing in the code. It's a fundamental semantical problem. You can't have "make the last call in this function be an implicit call to some function" and "make the last call be the explicit call to this other function" at the same time.
comment 5y ago · link · parent
comment 5y ago · link · parent
#include <iostream>
int main() {
std::cout << "hello, world!" << std::endl;
}
If my cursor is after "main", then M-f will move my cursor to after "std". It completely ignored "()" and "{". Another M-f moves my cursor to after "cout". Here it ignored "::". Another M-f moves the cursor to after "hello" ("<<" and the quote-mark ignored), another to after "world", and another to after "std" (quote-mark and "::" ignored) etc. It behaves similarly when hitting C-Backspace, where sometimes half a line disappears suddenly, because it was punctuation-heavy. I think once I stumbled upon code where it deleted several lines. On the other hand, when I have a variable like "big_number", then Emacs will happily jump into the middle of it. Even though it's an indivisible token in the eyes of the language's lexer. Of course there is a well-known hack of adding the "_" character to be recognised as a "word character". But it doesn't solve the issue really. The issue is that forward-word uses just one set of word-characters, instead of several sets of characters/regexes for different syntactic categories, which would enable jumping first to "cout" and then to "<<".comment 5y ago · link · parent
Both situations prevent you from reusing memory previously used by other objects, which isn't being utilized for anything useful at that point. The distinction is valid formally, but from a practical point of view sounds rather academic.
> And to prove the difference between "cannot be referenced" (a property that can in principle be checked by consulting a snapshot of RAM at an instant in time) and "will not be referenced" (a larger set, we will never reference things that cannot be referenced, but we may not reference things that are reachable, depending on code) feels like it is requiring solving the halting problem.
As usual, looking for a general solution to such a problem is probably a fool's errand. It's much easier to write code simple enough that it's obvious where things are referenced. Rust's lifetime semantics help with that (if your code isn't all that simple, it will be apparent in the overload of punctuation). If not Rust, then at least it would be good if you could check liveness of an object in a debugger. In C you can check whether a particular allocation was undone by a free() or equivalent. I'm not aware of any debugger for e.g. Java which would let me point at a variable and ask it to notify me when it's garbage collected, but it sounds like something that shouldn't be too hard to do, if the debugger is integrated with the compiler.
comment 5y ago · link · parent
Overall, I don't think you need the full power of paredit when programming. For any given language, your editor movement commands understanding what tokens in this language look like will usually already be sweet and enough.
comment 5y ago · link · parent
As far as the actual issue goes, it's their App Store, they have their rules and are free to execute them as they see fit. Given how you can easily distribute your apps outside of App Store, it's a completely different situation from the duopoly on mobile devices, where developers don't have a choice.
comment 5y ago · link · parent
It is my experience that when people work with GC languages, they treat the GC as a blackbox (which it is) and simply won't bother investigating: do they have memory leaks? Of course not, they are using a GC after all, all memory-related problems solved, right? Right... With code that relies on free(), I can use a debugger and check which free() calls are hit for which pointers. Even better, I may use an arena allocator where appropriate and don't bother with free() at all. With a GC I'm just looking at some vague heap graph. Am I leaking memory? Who knows... "Do those numbers look right to you?"
Memory management issues are usually symptoms of architectural issues. A GC won't fix your architecture, but it will make your memory management issues less visible.
It is my experience that most memory problems in C come from out-of-bounds writes (which includes a lot more than just array access), not from anything related to free(). A GC doesn't help here.
comment 5y ago · link · parent
GC protects you against double-free and use-after-free, but memory leaks? Nope.
comment 5y ago · link · parent
1. When editing a comment, the textarea is tiny and placed in a pop-up, instead of in the page. Can't resize that to see the comment better.
2. After disabling shortcut overrides, the shortcuts are simply disabled, along with the default browser behaviour for them.
3. Refreshing a page resets scroll-status. Seriously, webdevs, stop hijacking normal browser scroll behaviour. You always make it worse, never better.
4. If your login session times out when you're writing a comment, you can't publish it, but the error message isn't clear about the reason why. There was some button in the error message that caused you to lose the entire contents of the comment you were writing. Happened to me several times after writing comments 8+ paragraphs long. It's infuriating.
comment 5y ago · link · parent
Other licenses not compatible with GPL:
- Apache License (only version 2 is compatible and only with version 3 of GPL);
- GPL (v2 vs v3), as other comments already mentioned.
Are the authors of those licenses bullies? No. Nobody needs to care about your favourite flavour of copyleft.
comment 5y ago · link · parent
When you use (non-tail) recursive function calls, your memory will grow faster than with an explicitly managed stack, because now at each recursion level not only will you store all the things you would store in the explicitly managed stack, but also all the other variables and some intermediate values. Explicitly managed stack, that is implemented efficiently (i.e. mostly contiguous memory, not a linked list like in the example given), will give you better performance and will be easier to debug, because now you can query its size and identify where in the program you're using a given amount of memory; in the debugger you can inspect it as a whole in a multitude of ways (as opposed to the black box of a function where you'll only inspect one recursion level at a time, leaving you with scattered information and without easy to read performance metrics). That said, recursion is usually the simplest thing to write on the first try, when coming up with a solution to a problem. But I do tend to "defunctionalize" later.
comment 5y ago · link · parent
Emacs has nothing to do with shell prompts. It's a GUI editor as well. Emacs philosophy goes against Unix. I e.g. never use the terminal mode. Otherwise, your points seem on-point.