The Physics of Software
an investigation into the true nature of software
  • The idea
  • The story so far
  • Papers
  • Random notes
  • Me

From theory to practice to... more practice

6/14/2016

 
My nCrafts talk (On Growth and Software) is, in a sense, applied physics of software, that is, it's an example of the reasoning style that is supported and inspired by an understanding of forces and reactions. That's one step from theory into practice.

At the end of the talk, I quickly proposed a simple way to break symmetry in a traditional OO language (C# in this case) and how we can make it completely type-safe through an extension to the language, that is, the ability to impose constraints on the type systems in the form of (logical) implications.

The straightforward way to do so is to modify the language / compiler, but it turns out that with the latest C# compiler you can extend the compiler pipeline to some extent, through so-called Code-Aware Libraries. You can't add new keywords, but if you can reframe your extension in terms of the existing language, the big win is that a Code-Aware Library will work with the standard C# compiler.

I decided to do yet one more step into practice and implement my extension as a CAL. It was relatively straightforward and it worked well in practice, although I had to accept a slightly less minimal syntax. Here is an example of the error messages you get when:

- you try to safely cross-cast between interfaces not related by an implication.
- you state an implication between interfaces, but then have a concrete class that does not respect the implication.

Picture

The code/extension is not public yet and you'll have to watch the presentation to understand the reasoning behind it.

So this is a double step into practice, or as I mentioned in my DDDEU talk, an example of how understanding forces can ultimately lead to create materials (language constructs) on purpose, pretty much like material engineering.

​

Comments are closed.
    Some random thoughts that
    I'm not smart enough to keep to myself.


    RSS Feed

    Archives

    September 2019
    February 2018
    July 2016
    June 2016
    May 2016
    April 2016
    February 2016
    January 2016
    August 2015
    November 2014
    October 2014

Powered by Create your own unique website with customizable templates.