Posts

  • nREPL 1.4

    nREPL 1.4.0 is out! This month we celebrate 15 years since nREPL’s development started, so you can consider this release part of the upcoming birthday celebrations.

    So, what’s new?

    Probably the highlight is the ability to pre-configure default values for dynamic variables in all nREPL servers that are launched locally (either per project or system-wide). The most useful application for this would be to enable *warn-on-reflection* in all REPLs. To achieve this, create ~/.nrepl/nrepl.edn with this content:

    {:dynamic-vars {clojure.core/*warn-on-reflection* true}}
    

    Now, any nREPL server started from any IDE will have *warn-on-reflection* enabled.

    $ clojure -Sdeps "{:deps {nrepl/nrepl {:mvn/version \"1.4.0\"}}}" -m nrepl.cmdline -i
    user=> #(.a %)
    Reflection warning, NO_SOURCE_PATH:1:2 - reference to field a can't be resolved.
    

    Note: nREPL doesn’t support directly XDG_CONFIG_HOME yet, but you can easily override the default global config directory (~/.nrepl) with NREPL_CONFIG_DIR.

    Another new feature is the ability to specify :client-name and :client-version when creating a new nREPL session with the clone operator. This allows collecting information about the clients used, which some organizations might find useful. (I know Nubank are making use of this already)

    One notable change in nREPL 1.4 is the removal of support for Clojure 1.7. Clojure 1.7 was released way back in 2015 and I doubt anyone is using it these days, but we try to be extra conservative with the supported Clojure versions and this is only the second time nREPL’s runtime requirements were bumped in the 7 and a half years I’ve been the maintainer of the project. (early on I bumped the required Clojure from 1.2 to 1.7)

    As usual the release features also small bug-fixes and internal improvements. One such improvement was the introduction of matcher-combinators in our test suite. (which was the main motivation to bid farewell to Clojure 1.7) You can check out the release note for a complete list of changes.

    That’s all I have for you today. I hope we’ll have more exciting nREPL news to share by nREPL’s “official” birthday, October 8th.1 Big thanks to everyone who has contributed to this release and to all the people supporting my Clojure OSS work! In the REPL we trust! Keep hacking!

    1. nREPL 0.1 was released on Oct 11, 2015. 

  • Weird Ruby: Anonymous Heredocs

    Heredocs in Ruby are quite common, quite flexible, and… somewhat weird. Still, this doesn’t stop people from suggesting more features for them, like this (rejected) proposal for an anonymous heredocs syntax:

    # regular Ruby code
    Markdown.render <<~MARKDOWN
      # Hello there
    
      This is a Markdown file. See?
    
      1. This is a list
      2. With items
      3. And more items
    MARKDOWN
    
    # proposed syntax
    Markdown.render <<~
      # Hello there
    
      This is a Markdown file. See?
    
      1. This is a list
      2. With items
      3. And more items
    ~>>
    

    Even though this proposal didn’t make it, you can get pretty close by just using _ as your heredoc delimiter:

    Markdown.render <<~_
      # Hello there
    
      This is a Markdown file. See?
    
      1. This is a list
      2. With items
      3. And more items
    _
    

    Looks a bit weird, but it gets the job done.

    That’s all I have for you today. Keep Ruby weird!

  • CIDER 1.18 ("Athens")

    Great news, everyone - CIDER 1.18 (“Athens”) is out!

    This is a huge release that has an equal amount of new features, improvements to the existing ones, and also trimming down some capabilities in the name of improved efficiency and maintainability.

    I’m too lazy to write a long release announcement today, so I’ll just highlight the most important aspects of CIDER 1.18 and how they fit our broader vision for the future of CIDER.

    Let’s go!

    Reduced surface area

    • CIDER 1.18 dropped support for Boot and Emacs 26. Boot development has been frozen for many years, and it’s now a long past due to migrate to other build tools.
    • CIDER no longer bundles Puget dependency. Puget is still supported as a pretty-printer for all CIDER output, but you need to add it to dependencies explicitly.
    • Haystack is no longer included. With it, we removed some largely unknown facilities for parsing printed stacktraces and presenting them inside *cider-error* buffer.
    • Replaced the outdated thunknyc/profile dependency with a homegrown implementation in Orchard.

    I’m happy that we continue on the path of reducing the 3rd-party dependencies in cider-nrepl and rely more and more on functionality optimized for our use-cases, living in Orchard. Looking back, at some of the decisions I’ve taken in the past - I sometimes regret going overboard with the feature set (we have so many features today, that even I occasionally forget about some of them) and the dependencies needed to provide certain features. Going forward I hope to gradually reduce the feature set and the dependencies by:

    • removing features that are rarely used
    • making certain dependencies optional (instead of bundling everything with cider-nrepl)

    Inspector

    Our beloved inspector got a lot better!

    • New analytics module (orchard#329) (shows you some useful info about the data you’re inspecting)
    • Table view mode (orchard#331) (I think you’ll totally love this!)
    • Pretty-printing mode (#3813) and a command to separately pretty-print the currently inspected value (#3810)

    That’s how the analytics and the table view look:

    inspector-analytics

    table-view-mode

    Cool stuff!

    Error handling

    • In exchange for removing Haystack, CIDER now allows jumping to munged Clojure functions and Java methods anywhere from the source buffers or the REPL. This means that you can press M-. on printed frames like clojure.core$with_bindings_STAR_.doInvoke or clojure.lang.Compiler$InvokeExpr.eval within the exception, and CIDER will take you there.
    • Stacktrace processing has been greatly simplified and optimized. You may notice that the delay between an exception occuring and *cider-error* buffer popping up disappeared, especially in big projects.
    • Ex-data is now always displayed for each exception cause which has it, albeit in an abbreviated form. You can click or press RET (a.k.a. Enter) on to open it in the inspector (