Saturday 15 August 2020

Slider 2

Download link of Zip file
After developing a new Slider version, and making further adjustments to it, I've published it in this Zip file, along with a PDF file documenting it. The Zip file includes the PDF, compiler and runtime system, which I expect are ready to use.

As stated in the first version's description, this programming language (named after its garbage collector, which slides objects along in memory) does garbage collection by crawling the web of object references, starting at the roots (variables and parameters of running function invocations), building up a list of pointers to live (used) objects, then sorting that list, then iterating through it and moving each live object into the next available space in the heap.

The compiler is written in Yeti and outputs C source code. Slider uses message-passing concurrency with a separate garbage-collected heap for each thread, and has tail calls, a static type system with type inference, and polymorphic records similar to Yeti. The Slider compiler can infer the types of record fields and variant cases, including recursive types. Record and variant types need not be defined manually.


The Slider 2 project has consisted of developing a new version of Slider, correcting the old errors and adding much additional functionality and a far more clear and expressive new syntax (shown and described in the tutorials and language reference contained in the PDF) similar to Java.
 
The following features have been added to Slider, as of version 2:  

1. A fast sorting process/algorithm for the pointer list, which must be sorted so that live objects can be moved without damaging each other. Moving existing live objects enables new objects to be created quickly.
2. Object-oriented programming, which enables the same object to behave both as a record and as a variant.
3. A clear and conventional syntax. As can be seen in the example code (in the tutorials), Slider looks similar to Java, the most striking difference being the absence of manual type annotations.
4. Option types - a special kind of variant type that represents a reference that might be null.
5. Wrappers around more C functions have been added - the ability to call various C functions provides more capabilities, e.g. interacting with the file system, drawing graphics, writing network services, interacting with databases, or serving dynamic Web content.
 
The Slider compiler has been tested running on Java 8, and generates C code that has been tested by compiling with GCC and Clang (the two most popular open source C compilers) into both 32-bit and 64-bit code. As shown in the tutorials, Slider programs are now able to run as FastCGI application servers (which enables writing dynamic Web content in Slider), and to call APIs such as OpenGL ES and the standard C file API (among others). 

The following features are planned for future version(s) of Slider:
1. Optional region-based memory management with region inference, similar to SML (MLKit). This has the potential to reduce pause times without necessarily reducing overall performance - indeed, it often increases performance, and may enable Slider to compete with hand-written high-performance C or C++ on raw speed in the general case.
2. Integration with functions that parse and write various binary formats and are auto-generated from descriptions of those formats (similar to protobuf).
3. Inner classes that are defined in a method and record variables from it, similar to Java's anonymous inner classes.
4. General method overloading. Currently Slider methods are overloaded only based on the number of parameters and the "this" parameter (in Slider, there is no sharp distinction between overloading and overriding).
5. Named lists of classes that can be used in a "case" command.
6. Extension methods, i.e. methods of a class that are declared outside the class.

7. Integration with tools that prove properties of programs, such as absence of runtime errors (e.g. out-of-bounds access to arrays or strings).

8. Various other enhancements in performance and in the type system's flexibility.

9. Ability of Slider threads to suspend, resume, or yield to each other, passing data to each other on the C stack as they do.