Hacker Newsnew | past | comments | ask | show | jobs | submit | more matvore's commentslogin

If you store the number of zeros as value z, computing z+1 is O(log n) in the long run for unbounded values of z.


If you define predictable as computable with finite memory, it is correct.

If you have finite memory, you have a finite number of states and will eventually return to a previous state. In your example, you eventually will run out of memory to track the number of consecutive zeros.


  > No, they're crazy. I already have a window manager I like; I don't need my 
  > terminal to implement their own half-assed one,
Basically agree, though note that ssh and dtach and similar tools need to create pty's on the server and client ends because they implement essentially an adapter between a tty and a byte stream.


  > I notice no 1 second delay when switching modes with the Esc key, so perhaps 
  > this is something you can configure in your terminal.
This is configurable in Vim. ttimeoutlen, timeoutlen, and noesckeys are pertinent. tmux et al may also need tweaking.


What does `Ctrl + [` send to the terminal for you if not esc? In my experience these are always the same, so Vim shouldn't be able to tell the difference unless it's a GUI-integrated version like gVim.

Try to run `xxd` and then press Ctrl-V and either Ctrl+[ or Esc, then Enter and Ctrl+D. Typical terminal setups will show the same codes both times (1b0a for esc and \n).

Alt+Space (or Alt+J Alt+K Alt+B to go up, down, left one word from current position after returning to normal mode) is what I often do which should work universally.


  > I stick with emacs because of the modal and recursive minibuffer(s) (ie. command-line(s)). What vim setting do I change to be able to use normal mode down there?
Not a setting. Just press Ctrl+F when your cursor is in the command line. After that, and until you finish entering the command, you will be able to use Esc to go into normal mode again.


I "discovered" that feature by accidentally pressing q: instead of :q in the editor. Never knew about the Ctrl-F option, thank you!


The last time I used a leak finder, a memory allocation which still has a ptr to it is not a leak.

You are conflating unfreed memory with unreferencable memory.


Reachability is one strategy for detecting leaks but it's not the only one. Checking for unfreed memory is easier to implement.


Huh? People use their fingers to press ctrl? :p


Once you use Caps as Ctrl you wont get back :P


I tried swapping CAPS and Ctrl, and I understand the appeal, but I guess I just like pressing Ctrl in the default row - sometimes swapped with superkey - with my palm.


For most terminal emulators (and not gVim or editors with Vim bindings), you can also use Alt+[first key you want to type in normal mode]. e.g. Alt+J to enter normal mode and go down one line. Or Alt+Space to enter normal mode and go forward one space (which usually has the apparent effect of entering normal mode without shifting the cursor backwards, which is pretty intuitive).


I sympathize a bit with the dislike of enum. We could also probably get away with replacing typedef's with either #define (for simple types) or one-field structs (for arrays and function pointers; the latter usually need a void* to go along with them anyway).

There are reasonable low-level optimizations you can do that switch is needed for. You can have cases that start or end around blocks in non-hierarchical ways. This makes it similar to a computed goto.


This is a very slipery slope (where gcc/clang[llvm] just run onto): adding tons of attributes/keywords/"syntax features" which gives the compiler some semantic hints in order to perform "better" optimizations. There is no end to it, this is a toxic spiral of infinite planned obsolescence (and now ISO is doing the same).

There is also this other thing: extreme generalization and code factorization, to a point, we would have no clue of what the code actually does without embracing the entirety of the code with its "model". It did reach a pathological level with c++.

And the last, but not the least: OS functions are being hardcoded in the syntax of the language.

If you push further all those points they kind of converge: compilers will have keywords specific for each performance critical syscall, significant library function, and significant data structure for abstraction (some abstraction can be too much very fast as I said before). There is a end game though: directly coding assembly.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: