Design and implementation of a data-oriented programming language solving complexities and runtime faults found in other languages
Creators: name: Nordgren, Henrik
Publisher: name: Henrik Nordgren
Year: 2024
Subjects: LLVM
programming language
data-oriented programming
compiler

description: This thesis explores the design and implementation of Dash, a novel programming language based on data-oriented programming (DOP) principles, in order to prevent common software faults while preserving simplicity, reliability and performance. The DOP paradigm enforces immutability and generality for the sake of simplicity and reusability, while attempting to mitigate performance impacts. Moreover, DOP is considered a language agnostic paradigm with many implementations in other programming languages, creating an opportunity to explore how it could be implemented at the language level.

The thesis examines software vulnerabilities listed in the Common Weakness Enumeration (CWE) database, in order to determine common software faults. By combining DOP principles with well-known safety mechanisms Dash implements language features like generic structural types, type predicates, explicit error handling and immutable data structures. The feasibility of DOP at the language level is demonstrated through a functioning compiler in Go using LLVM as the backend that implements the DOP principles as core language constructs. Moreover, the language's effectiveness is assessed by comparing it with Go and Rust in a number of areas, such as state management, type system capabilities, safety guarantees and code readability. 

The thesis finds that certain modifications of the original principles are required to successfully implement DOP at the language level. Most notably, the language implements generic structs with compile-time type checking to preserve flexibility and type safety, rather than using hash maps with string-based field references as prescribed by DOP. Additionally, because concrete types are required for compilation, the separation between data schema and data representation becomes more closely coupled at the language level. However, this is lessened by features like type predicates, optional types and union types. Furthermore, in order to handle program state transitions while preserving immutability, the language uses atomic compare-and-swap operations instead of the conventional stateful class approach outlined in DOP.

This thesis reiterates how important careful language design is in preventing common software vulnerabilities. Dash's type system eliminates common issues like null pointer dereferences, type confusion and unhandled errors through compile-time checks and runtime guards. Integer overflow vulnerabilities are prevented through arbitrary precision number types, while string manipulation errors are mitigated by maintaining explicit length information rather than relying on null termination. Memory safety is enhanced through immutable data structures, reference counting and runtime checks, preventing faults such as use-after-free, expired pointer dereference and buffer overflow vulnerabilities.

The evaluation shows that Dash's immutable state management and explicit error handling provide stronger safety guarantees than Go while being simpler than Rust's ownership system. While Dash's approach results in slightly more verbose code compared to Go and Rust, its type system combines Go's simplicity with additional safety features like type predicates and null safety, making it suitable for implementing simple and robust software systems.

Further research is needed to thoroughly validate the language's design decisions and safety guarantees in the real world that go beyond the arithmetic evaluator. Dash's performance characteristics, especially in relation to memory management overhead and the efficiency of its error handling system in preventing runtime crashes, require more investigation in order to be empirically compared with other similar languages. Moreover, unimplemented parts of the language specification and areas such as memory management, concurrency, performance optimisations and developer tooling need to be implemented to make Dash production ready.