Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Augmenting Dynamic Typing with Static-Analysis

Augmenting Dynamic Typing with Static-Analysis

Today’s statically-typed functional programming languages give developers great confidence over correctness and an excellent tool during refactoring. With tools like core.typed (Clojure) and Dialyzer (Erlang), dynamically-typed language users are able to take advantage of many of these benefits as well. In this talk, we’ll explore the success typing space. Further, we’ll see some real-world examples where Basho has used Dialyzer to create better assuredness and documentation in their database: Riak.

Reid Draper

July 22, 2014

More Decks by Reid Draper

Other Decks in Programming


  1. %% Return a list of locators, in our case, we'll

    use cluster names %% that were saved in the ring cluster_mgr_sites_fun() -> %% get cluster names from cluster manager Ring = riak_core_ring_manager:get_my_ring(), Clusters = riak_repl_ring:get_clusters(Ring), [{?CLUSTER_NAME_LOCATOR_TYPE, Name} || {Name, _Addrs} <- Clusters].
  2. %% @doc Return a list of all manifests in the

    %% `active' or `writing' state active_and_writing_manifests(Dict) -> orddict:to_list(filter_manifests_by_state(Dict, [active, writing])).
  3. %% @doc Return a list of all manifests in the

    %% `active' or `writing' state -spec active_and_writing_manifests(orddict:orddict()) -> [{binary(), lfs_manifest()}]. active_and_writing_manifests(Dict) -> orddict:to_list(filter_manifests_by_state(Dict, [active, writing])).
  4. JavaScript Java PHP C# Python! C++ Ruby C Objective-C CSS

    Perl Shell Scala Haskell R Matlab Clojure CoffeeScript Visual Basic Groovy http://redmonk.com/sogrady/2014/01/22/language-rankings-1-14/
  5. Retrofitting a type system into a language not designed with

    typechecking in mind can be tricky; ideally, language design should go hand-in-hand with type system design. Benjamin C. Pierce, Types and Programming Languages p. 9
  6. adding dynamic types to a statically-typed language 1989 M. Abadi,

    L. Cardelli, B. Pierce, G. Plotkin, statically-typed language
  7. "The key concept of soft typing is that a type

    checker need not reject programs containing statically 'ill typed' phrases" 1991 Robert Cartwright, Mike Fagan,
  8. Marlow and Wadler add static- types to Erlang* 1997 *

    with some caveats… Andrew K. Wright , Robert Cartwright,
  9. "In contrast, optional type systems are neither syntactically nor semantically

    required, and have no effect on the dynamic semantics of the language." 2004 Gilad Bracha,
  10. The design and implementation of typed scheme 2008 now called

    Typed Racket Tobin-Hochstadt, Felleisen,
  11. (: flexible-length (-> (U String (Listof Any)) Integer)) (define (flexible-length

    str-or-lst) (if (string? str-or-lst) (string-length str-or-lst) (length str-or-lst)))