Indurate

From Esolang
Jump to navigation Jump to search
Indurate
Paradigm(s) concurrent, functional, generic, imperative, structured
Designed by User:OliveIsAWord
Appeared in 2022
Computational class Unknown
Major implementations Rust
File extension(s) .indurate

Indurate, also known as Friable, is a subset of the Rust programming language focused on the safety, immutability, and elegance that is lost in the disgraceful, hedonistic use of Rust proper.

Restrictions

  • Use of mutability is prohibited. No variables or function arguments may be marked as mut. Any types which allow mutability, such as the mutable reference, are similarly barred.
  • Use of unsafe code is prohibited. Under no circumstances can an unsafe block be created, nor can any function or trait be marked as unsafe.
  • Given the sinful and flagrant breaches of the two previous points throughout the Rust standard library, any use therein is prohibited, including the prelude. This chiefly targets the std and core crates.

To assure no use of the standard library, all Indurate code should begin with:

#![no_implicit_prelude]

Additionally, the code should be compiled in Rust edition 2018 or greater, to assure that the procedural macros as well do not seep in.

Ramifications

It is unclear if a useful binary could ever be created. Access to files, stdin/stdout, or any I/O functionality is unavailable. Additionally, any return value from the main function must implement the std::process::Termination trait, and as such the only possible return types are the unit type () and the never type !, neither of which can hold data. It might be possible to transmit one bit of information by deciding whether the program terminates; however, determining in the general case whether an Indurate program will terminate is currently not feasible. Nonetheless, like its parent language, library code is still entirely possible.

Computational class

Indurate is potentially Turing complete, that is, for any Turing machine, an Indurate program which halts if and only if the Turing machine halts might be created. One major issue is allocating memory. Without that, the language would be reduced to FSA complexity. There is the unstable box keyword which is an alias for Box::new(), but it's unclear how to utilize it (e.g. by creating a linked list) without referencing the Box type itself. Current versions of Rust have deprecated this.

Two seemingly useful options are closures and tuples. It may be possible to nest closures or tuples to increment. In both cases there are typing issues, particularly with closures since each closure has its own unique type in the program. The typing issues of tuples may be overcome with traits. In either case, function calls would have to be used to perform state modifying transitions, replacing goto. Since Rust has lexical scoping, and these nested structures would be stack allocated, and the size of function arguments must be known at compile time, these options are infeasible.