Git Product home page Git Product logo

ppx_useless's Introduction

ppx_useless

Disclaimer This project is a joke and should be taken seriously only by people without humor.

This project provides the ppx_useless OCaml compiler extension, that replaces the code with the following statement:

let () = ()

Now this might seem controversial to the casual, but there are benefits to be had.

Useless features:

  • Reduces compile errors
  • Reduces runtime errors
  • Reduces binary size
  • Simplifies debugging
  • Increases speed
  • Decreases memory usage (both at compile-time and run-time)

Useful features:

  • Wastes CPU cycles, which in turn heats your room
  • There's at least a possibility that the program produces the desired output, which means that any input would suffice as a solution, which in turn saves time for the programmer.

However, some programs are not expected to terminate (e.g. server programs) and for those kinds of programs the ppx_diverge is provided that replaces every expression with:

let rec diverge () = diverge () in diverge ()

which provides the desired non-termination. An added benefit here is that there's no longer any need for messing about with configuration files!

Here the observant reader interjects: "But even a trivial but deterministic program can be useful (e.g. /bin/true)!" True, true is a very useful program and to address that the ppx_nondeterministic extension is provided. Here's a sample session from utop:

> 2+2;;
- : int = 4

> 2+2;;
- : int = 3

> 2+2;;
- : int = 5

Observe here that there is a possibility of obtaining the expected result. And be honest, who doesn't what more non-determinism in their lives?

Usage

The provided Makefile contains instructions on how to build the different useless extensions, but the impatient can invoke utop like so:

  • for useless programs: make useless-utop
  • for non-terminating programs: make diverge-utop
  • for non-deterministic programs: make nondeterministic-utop

ppx_useless's People

Contributors

rootmos avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.