1. 4

    I switched to the Colemak keyboard layout ~2010 and have been using it since. On GNU/Linux with setxkbmap us -variant colemak and on windows with PKL.

    At home, I use a TVS Gold keyboard - I like its tactile response but the keys are a little to sharp around the edges - ~10 years old now. At work, I use a Microsoft Natural Ergonomic 4000 - ~ 6 years old now.

    1. 1

      How long did it take to learn Colemak for you, so that it became “normal” for you?

      Did it make you type more accurate, as in making less typos?

      1. 3

        Edit: Found an old comment of mine that may more accurately represent my initial reaction (after 2 years) https://forum.colemak.com/post/12525/#p12525

        I used to type around 60wpm in QWERTY - used only 3 fingers on each hand. My unconventional typing style lead to intense, persistent pain between my left ring and middle finger knuckles while writing up my undergrad project reports. I initally blamed it on Emacs and switched to using a folded-in thumb for pressing control instead of my little finger(something I follow till date). However, I realized the pain was due to my unusual finger positions while using E and R. I switched to Colemak in the first few months of my masters where I had a few light weeks when I could switch cold turkey. It took me around 2 weeks to get to ~20wpm and after a month or 2 I hit 60-70wpm. I can currently type at around 80wpm steady and haven’t bothered trying to type any faster. [edit] I try to prioritize accuracy over speed - I did get a little more precise with pressing the keys after switching - but that can be primarily attributed to learning touch-typing and positioning my fingers on the home-row [/edit]

        I don’t use any customizations other than changing the keyboard layout. Some people claim that replacing hjkl by enio in vim helps their case, but I keep things as vanilla as possible. I love the extra backspace instead of caps-lock.

        side note: Not having touch-typed with all fingers before was an advantage. Putting my fingers on the home row automagically switches my mental mapping to colemak while positioning my index fingers over “k” and “d” in qwerty keyboards makes my hand start typing in qwerty instead. This helps when I am on some other person’s computer.

    1. 2

      mosh+tmux on the remote machine. Msys2 full scren on the external monitor for the terminal. I use tmux sessions extensively. This has been the most reliable set up for me for clipboard and the rest. I use everything else on the remote machine. I have emacs installed on Windows though syncing with the remote session for org mode - I store a lot of hyperlinks in it.

      1. 1

        I’d not heard of MSYS2. that looks fabulous, thank you VERY much!

      1. 24

        MISRA (the automotive applications standard) specifically requires single-exit point functions. While refactoring some code to satisfy this requirement, I found a couple of bugs related to releasing resources before returning in some rarely taken code paths. With a single return point, we moved the resource release to just before the return. https://spin.atomicobject.com/2011/07/26/in-defence-of-misra/ provides another counterpoint though it wasn’t convincing when I read it the first time.

        1. 8

          This is probably more relevant for non-GC languages. Otherwise, using labels and goto would work even better!

          1. 2

            Maybe even for assembly, where before returning you must manually ensure stack pointer is in right place and registers are restored. In this case, there’s more chances to introduce bugs if there are multiple returns (and it might be harder for disassembly when debugging embedded code).

            1. 1

              In some sense this is really just playing games with semantics. You still have multiple points of return in your function… just not multiple literal RET instructions. Semantically the upshot is that you have multiple points of return but also a convention for a user-defined function postamble. Which makes sense, of course.

            2. 2

              Sure, but we do still see labels and gotos working quite well under certain circumstances. :)

              For me, I like single-exit-point functions because they’re a bit easier to instrument for debugging, and because I’ve had many time where missing a return caused some other code to execute that wasn’t expected–with this style, you’re already in a tracing mindset.

              Maybe the biggest complaint I have is that if you properly factor these then you tend towards a bunch of nested functions checking conditions.

              1. 2

                Remember the big picture when focusing on a small, specific issue. The use of labels and goto might help for this problem. It also might throw off automated, analysis tools looking for other problems. These mismatches between what humans and machines understand is why I wanted real, analyzable macros for systems languages. I had one for error handling a long time ago that looked clean in code but generated the tedious, boring form that machines handle well.

                I’m sure there’s more to be gleaned using that method. Even the formal methodists are trying it now with “natural” theorem provers that hide the mechanical stuff a bit.

                1. 2

                  Yes, definitely – I think in general if we were able to create abstractions from within the language directly to denote these specific patterns (in that case, early exits), we gain on all levels: clarity, efficiency and the ability to update the tools to support it. Macros and meta-programming are definitely much better options – or maybe something like an ability to easily script compiler passes and include the scripts as part of the build process, which would push the idea of meta-programming one step further.

              2. 5

                I have mixed feelings about this. I think in an embedded environment it makes sense because cleaning up resources is so important. But the example presented in that article is awful. The “simpler” example isn’t actually simpler (and it’s actually different).

                Overall, I’ve only ever found that forcing a single return in a function often makes the code harder to read. You end up setting and checking state all of the time. Those who say (and I don’t think you’re doing this here) that you should use a single return because MISRA C does it seem to ignore the fact that there are specific restrictions in the world MISRA is targetting.

                1. 4

                  Golang gets around this with defer though that can incur some overhead.

                  1. 8

                    C++, Rust, etc. have destructors, which do the work for you automatically (the destructor/drop gets called when a value goes out of scope).

                    1. 1

                      Destructors tie you to using objects, instead of just calling a function. It also makes cleanup implicit vs. defer which is more explicit.

                      The golang authors could have implemented constructors and destructors but generally the philosophy is make the zero value useful, and don’t add to the runtime where you could just call a function.

                    2. 4

                      defer can be accidentally forgotten, while working around RAII / scoped resource usage in Rust or C++ is harder.

                    3. 2

                      Firstly he doesn’t address early return from error condition at all.

                      And secondly his example of single return…

                      singleRet(){
                          int rt=0;
                          if(a){
                              if(b && c){
                                  rt=2;
                              }else{
                                  rt=1;
                              }
                          }
                          return rt;
                      }
                      

                      Should be simplified to…

                      a ? (b && c ? 2 : 1) : 0
                      
                      1. 1

                        Are you sure that wasn’t a result of having closely examined the control flow while refsctoring, rather than a positive of the specific form you normalised the control flow into? Plausibly you might have spotted the same bugs if you’d been changing it all into any other specific control flow format which involved not-quite-local changes?

                      1. 1

                        Wasn’t this feature initially there in smalltalk? I distinctly remember playing with a smalltalk dialect like Pharo a few years ago and was blown away when I stumbled upon this feature in the menu.

                        1. 1

                          You’re right, in this blog post the author mentions that they were inspired by the implementation of this feature in pharo.

                        1. 6

                          I’m finally back to Rust coding and picked up my work on a CouchDB client again.

                          I’m in dire search for a catchy name.

                          1. 3

                            You can call it lasers because couches remind me of being lazy. And in good Rust spirit it has the letters ‘r’ and ’s' in the name.

                            1. 1

                              laze.rs sounds great.

                            2. 2

                              I like “crouch” because it’s simple and doesn’t seem like you’re trying too hard :P

                              1. 1

                                “Pantseat,” because that is the part of the pant that interfaces with a couch.

                                1. 1

                                  recline.rs - Not all couches are recliners, but it sounds like a nice name.

                                  1. 2

                                    I’ll put that into the pool, I decided to buy laze.rs - I just couldn’t pass on the opportunity :).

                                  2. 1

                                    Loose Change :)

                                  1. 1

                                    Here’s a script to help with the backwards incompatible configuration changes: https://github.com/fgsch/varnish3to4

                                    Note to self: never ever disrespect your open source projects' users like that. Either provide a stable public API or the tools to automate the migrations.

                                    1. 1

                                      Isn’t that what major versions are for?

                                      1. 1

                                        In my ideal world major versions are for major features, not major breakage.

                                        1. 3

                                          And stay stuck with mistakes forever? Is the only solution a fork? Majors aren’t meant to be backwards-compatible.

                                          1. 1

                                            Bug fixing and API stability are orthogonal concepts, aren’t they? Unless you mean mistakes in the API itself in which case I’ll remind you that no one really suffers from the typo in “HTTP referer”. And for more serious API design mistakes the proper punishment would be to keep maintaining the old version forever in addition to the new stuff you just added.

                                            1. 3

                                              Well, semver would disagree with you about never breaking backwards compat on API.

                                              Given a version number MAJOR.MINOR.PATCH, increment the:
                                              
                                              MAJOR version when you make incompatible API changes,
                                              MINOR version when you add functionality in a backwards-compatible manner, and
                                              PATCH version when you make backwards-compatible bug fixes.
                                              
                                                1. 1

                                                  That was the exception and not the example. Torvalds just thought there were enough features to warrant a new release and 2.6.40 seemed to be pushing it. http://thread.gmane.org/gmane.linux.kernel/1147415

                                                  1. 1

                                                    Well, in my ideal world (which someone thought it’s “-1 incorrect” :-) ) major versions for major features is the rule, not the exception. The Linux kernel is a good example of (public) API stability and we should learn from it.

                                    1. 1

                                      This was actually something I was wondering about for the last several days. I haven’t developed using OpenSSL or anything related to security or networks in the past. But is there no real alternative to OpenSSL? I would be genuinely surprised in this case given that almost every other library has multiple competing implementations.

                                      1. 2

                                        GnuTLS is the other open-source TLS implementation. It has its own set of security holes.

                                        1. 1

                                          A quick note: OpenSSL has a BSD license. GnuTLS is LGPL. You’re correct, I’m just noting the license differences.

                                          NSS is also open source (Mozilla/GPL/LGPL licenses).

                                          1. 1

                                            I was going to mention the license differences, but I’m not sure how much of a role that plays in deciding to use one or the other. Most software depending on a TLS implementation dynamically link to the shared library, so LGPL shouldn’t be an issue.

                                      1. 2

                                        While a majority of the article was a good read, I do not agree that the first #ifdef swallows an instruction

                                        #ifdef foo
                                        if(this) {
                                          then_that()
                                        } else
                                        #endif
                                           something_else()
                                        

                                        will always work correctly AFAICS.

                                        If foo is defined, the entire else part would be something else. It does not swallow any instruction.

                                        While that is piss-poor style, it is still correct.

                                        1. 2

                                          concurrency debugging multithreading

                                          1. 3

                                            This seems like a fairly old paper. Hasn’t there been much work since? Is there any particular reason why I would be interested in this particular paper?

                                            (I have worked on optimistic methods for general concurrency which includes lock-free and wait-free code and STMs, but I am interested since this paper seems to specifically talk about database concurrency)

                                            1. 11

                                              I use evil-mode in Emacs. This is almost feature-complete and supports text-objects. It also have various extensions like evil-surround and evil-numbers (for increment and decrement). I like to think of Emacs as a general-purpose development environment and evil-mode as the sensible keybinding list for editing. Since it supports all the features that the author has mentioned, I think it flies right at the face of the conclusion.

                                              1. 2

                                                Can you expand on the “general-purpose development environment” part? Specifically what IDE features you are using that VIM doesn’t have?

                                                1. 3

                                                  Feature debates tend to go down the wrong path because everyone uses a different subset.

                                                  Instead I find that the best argument for using emacs / EVIL over vim is based on how crappy vimscript is. Also, instead of thinking of emacs as another text editor, it’s probably better to think of it as a super powerful elisp repl that happens to do text editing. emacs internals are completely exposed to the user as opposed to what’s available via vimscript.

                                                  1. 1

                                                    Yeah, I have no intentions of starting a feature-off. I have recently started using emacs (evil-mode because muscle memory) but I still use it very much like vim, mostly because I have no exposure to the more ide like features (read none).

                                                    1. 2

                                                      Most of the stuff you get in an IDE you also get via extensions or standalone tool support (built-in debugger, project building, checkout / checkin, ctags / cscope support). I don’t mind keeping another terminal open for tooling stuff so that doesn’t bother me, but in my opinion the biggest advantage of IDEs is good ctags / cscope support.

                                                      Let’s take this example:

                                                      class A(object):
                                                          def foo():
                                                              pass
                                                      
                                                      class B(object):
                                                          def foo():
                                                              pass
                                                      
                                                      a = A()
                                                      a.foo()
                                                      

                                                      ctags has poor OOP hierarchy support and doesn’t know where a.foo() points to. It will bring up a list of all foo() definitions with the most likely one first. This is ok in small projects, but a pain point in larger codebases.

                                                  2. 1

                                                    I love the buffer management capabilities of Emacs. At any given point, I have 40+ buffers and with ido, buffer-name completion is brilliant. (perspective-mode is something you should not miss too)

                                                    The M-x shell is good enough for 99% of the things I need to do, but M-x term is always there (which can run a full vim inside it if you wanted) for more curses-oriented apps.

                                                    The self-documenting and completely customizable nature of the editor and most packages is also a very important feature for me.

                                                    I don’t really need auto-completion so much (M-/ in emacs | C-n C-p in evil) is often enough for me). But I do use auto-complete-mode when I know long words are going to repeat often enough.

                                                    With evil-mode find and replace shows a hint of what it is going to replace. Beat that, other editors.

                                                    Also, I use ace-jump-mode (which I think is inspired from a similarly named vim plugin) for lightning fast navigation. magit satisfies all my git needs.

                                                    I have been using dired for ages and I still think it is one of the best file-managers out there.

                                                    All said and done, given the number of languages I fiddle with, I don’t care about context-sensitive completion. I would need 10 different IDEs to do that efficiently. I am happy with a fast, dumb, text-based auto-complete.

                                                1. 1

                                                  Nice talk!

                                                  Nimrod looks pretty amazing. I do wonder how extensive use of deep metaprogramming holds up over time as far as maintainability – how well does months old code read when you need to get in there and fix something?

                                                  Anyone here used it at all for anything?

                                                  1. 2

                                                    I’ve toyed with Nimrod a year or two back. I never did enough with it to draw any real conclusions. I think you have to use a language every day for at least 3 months to be able to say anything useful about it.

                                                    As to deep metaprogramming, I think the problem with metaprogramming in most languages isn’t the metaprogramming itself but a lack of tooling to support it. Too much programming is based around tools (primarily text editors) for examing flat source files rather than having the ability to examine the shape of a running system. The Smalltalk community is great at providing tools for this and makes “metaprogramming” a dream to work. I hope that given Nimrod’s strong emphasis on metaprogramming that work goes into tooling that makes the systems that utilize it easy to explore and understand.

                                                    1. 1

                                                      The github repository for Nimrod is https://github.com/nimrod-code You could have a look yourself. I spent some time in the IRC channel of nimrod (#nimrod on irc.freenode.net). Araq (the creator) is quite active there. But there are several others who seem active in European hours. (Logs here: http://build.nimrod-lang.org/irclogs/).

                                                      The compiler itself is in Nimrod and there are at least 2 medium sized projects (aporia - the IDE) and nimrod-forum.

                                                    1. 2

                                                      Has anyone used fuse on FreeBSD? From the looks of things, they implemented the kernel side to match the same interface as Linux, and use the same libfuse code (port?) as Linux. Is that accurate?

                                                      The freebsd wiki is rather sparse and possibly outdated.

                                                      1. 1

                                                        You can enable Linux binary compatibility. It isn’t enabled by default IIRC.

                                                        http://www.freebsd.org/doc/handbook/linuxemu.html

                                                      1. 1

                                                        This was excellent. The InfoQ presentation on Raft can also complement this. http://www.infoq.com/presentations/raft

                                                        I wonder how the presentation was made. It looks really attractive.