Skip to content

A command line tool for DeMutabilization of EO programs

License

Notifications You must be signed in to change notification settings

objectionary/demu

Repository files navigation

logo

EO principles respected here DevOps By Rultor.com We recommend IntelliJ IDEA

mvn PDD status codecov Maven Central Hits-of-Code Lines of code License

DeMu

It's a well known fact that programs with immutable objects much easy to maintain, test and use, but the main benefit form immutable objects is that they allow performing more aggressive optimizations [1] and apply more valuable analysis. DeMu is exactly the tool for removing mutable objects like memory and cage from EO programs. Actually, DeMu is acronym for De-Muatabilization.

Methodology

There isn't single formal methodology or algorithm for converting mutable objects into immutable, but we can use some separate methods to achieve this.

Using SSA form for simple cases

We actually can apply SSA [2] form for eo programs. This approach can immediately remove some usages of mutable objects. Let's consider the following example:

[] > example
  cage 0 > index
  seq > @
    index.write 1
    stdout
      sprintf
        "%s"
        index
    TRUE

After applying SSA form we get something like the next:

[] > example
  seq > @
    stdout
      sprintf
        "%s"
        1
    TRUE

And as you can see - we removed usage of cage from the result program. The relation between SSA form and Dataflow Languages (like EO and, particularly, Functional Programming Languages) is quite well described in that article [3].

Using recursion for loops

The second method is to convert loops into recursive calls.

Related articles and links

  1. Immutability specification and its applications
  2. Global Value Numbers and Redundant Computations
  3. SSA is Functional Programming

How to Contribute

Fork repository, make changes, send us a pull request. We will review your changes and apply them to the master branch shortly, provided they don't violate our quality standards. To avoid frustration, before sending us your pull request please run full Maven build:

$ mvn clean install -Pqulice

You will need Maven 3.3+ and Java 8+.

About

A command line tool for DeMutabilization of EO programs

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Contributors 4

  •  
  •  
  •  
  •  

Languages