Ingredients-oriented paradigm

From Esolang
Jump to: navigation, search
This article is a stub, which means that it is not detailed enough and needs to be expanded. Please help us by adding some more information.

The ingredients-oriented programming paradigm is an esoteric programming subparadigm oriented towards Information Security, being harder to hack, and based on cooking. The basic structure is to mix a set of ingredients in a vessel. Ingredients must be declared during the program (preferably at the start) and may only be used once. An example of Hello World in the paradigm is:

stdout("Hello, World!")

Which effectively "Mixes" "Hello, World!" in the stdout vessel, which has the special property of sending its result product to the standard output.

Ingredients

The ingredient declaration syntax is:

[keywords] <type> <name>["["<count>"]"] = <value>

<type> is optional by language. This declares a group of ingredients of size <count> and type <type> named <name>, each item of the value <value>. For example:

byte b[256] = 100

Will declare 256 bytes of value 100. Whenever the "b" variable is referenced as an ingredient, one item is popped from the array and its value is used in the combinator. If b is referenced with a subscript after it (b[n]), then that many b's are popped from the array and used as arguments. This means that this:

byte b[4] = 5
sum(b, b, b, b)

is equivalent to:

byte b[4] = 5
sum(b[4])

This feature may be excluded in some languages.

Keywords, also language-dependent features, are used to affect the way a variable works. Some example keywords are:

  • Unending: Don't use up variables when used (used for constants)
  • ...

Mixing

In ingredients-oriented programming, actions are performed by Mixing ingredients in a vessel. The mixing syntax is:

vessel(ingredient1, ingredient2...)

For many vessels, ingredient order is irrelevant.

Vessels

Vessels are where ingredients are mixed. Vessels accept a list of arguments which's order may or may not matter and which may have special properties. Example vessels are:

  • mixer: Standard mixer
  • stdout: Prints its return value to the stdout
  • stderr: Ditto for the stderr
  • stdin: Automatically includes text from the stdin as an ingredient
  • (vessel class) port: Sends data to a port when flushed

Utensils

"Utensils" are the equivalent of first-class vessels in an ingredient language. They are similar to ingredients, except they aren't used up after usage in a declaration (and thus should not be used to store information). When mixed into a combinator, they are applied to all other non-utensil arguments, meaning this:

vessel(ut, var1, var2)

is equivalent to:

vessel(ut(var1), ut(var2))

Exception Handling

Exception Handling should be powerful such as to avoid crashes. For example, at the beginning of a program, this line may be able to be added:

#onerror <name> return <value>

This sets what value a vessel should output when an error is encountered during execution.

Examples

Hash an Input (with MD5)

import hash.md5 //Get the md5 utensil from the module
stdout("Input to hash: ") //Print out "Input to hash: "
stdout(mixer(md5, input())) // Hash the input by applying md5 utensil to input