Object disoriented
From Esolang
Object disoriented is an object-oriented programming language. This means that objects are the only kind of data it manipulates. It also belongs to the class of functional programming languages, especially "dysfunctional programming languages" alongside 0x29A.
Each object has two member data objects, a and b. In line with the best data encapsulation principles, other objects cannot read these member objects. As such, the only way to read these objects is to interface with the object's single member function. This prevents incorrect use of these member objects.
Since each object's interface is a single function that takes an object as an argument and returns another object, all object are interchangeable, and thus virtual. This encourages polymorphism and inheritance.
Contents |
[edit] Statements
| c** | Copy object * to object * |
| f** | Use function of object * on object *, discard result |
| * | This reads in an object, but then discards it (similar to a C++ statement). The f** statement is actually a special case of this. It can also be used to read in an input bit and discard it. Otherwise, this is pretty much a NOP. |
| o* | Output. Will add one bit to the output buffer. When the 8th bit is sent, an 8-bit char is printed. Send z for a 0, and "n fpz rz zz" for a 1. (other objects are undefined as of now) The bit order is most significant bit first, least significant bit last. |
| r* | Return *. This is also (necessarily) the end of the function, since there is no flow control anyway. |
[edit] Readable and writable objects (l-values)
| a | Member data a |
| b | Member data b |
| s | Self. The effects of writing to this haven't been clarified yet, but at least the currently running function continues its execution |
| t | Function local variable |
| p | Function parameter. It's passed by reference, so writing to this will affect the said object! |
[edit] Readable objects (r-values)
| z | Null object |
| f** | Return value of function of object * used on object * |
| n(f)** | New object with code (f) and member objects * and *. For instance, n rp zz creates an object that simply returns its argument |
| l"id". | Returns a new instance of class "id". |
| i | Input. Reads an 8-bit char into a buffer, and then reads the first bit. Subsequent references read following bits, until the buffer is empty and a new byte is polled. Returns z if the bit is 0, or "n fpz rz zz" (an object that activates it's parameter's function) if the bit is 1. The bits are read starting with the most significant bit. |
[edit] Definitions
| d"id".(f)** | Define class with name "id"., function (f), and member data * and * (often z and z) |
| dmain.(f)** | Define a class which is the program's entry point |
| ecomment. | This is a comment |
[edit] Examples
[edit] Cat program
e This is CAT . e This class is an infinite loop that inputs a bit and outputs it on each iteration . dcatloop. oi fsz rz zz e This class is the program's entry point; it simply runs the catloop class's function . dmain. flcatloop.z rz zz
[edit] Hello, world!
e This hello world program implements a 88 bits stack .
e The stack represents the 11 char ascii data .
e This function pushes a 0 onto a stack .
dp0.
cn
cas
rz
pz
p
zz
e This function pushes a 1 onto a stack .
dp1.
cn
cas
r n fpz rz zz
pz
p
zz
e This function creates a hello world stack .
dmakehelloworld.
flp0.a flp1.a flp1.a flp0.a flp1.a flp0.a flp0.a flp0.a e h .
flp0.a flp1.a flp1.a flp0.a flp0.a flp1.a flp0.a flp1.a e e .
flp0.a flp1.a flp1.a flp0.a flp1.a flp1.a flp0.a flp0.a e l .
flp0.a flp1.a flp1.a flp0.a flp1.a flp1.a flp0.a flp0.a e l .
flp0.a flp1.a flp1.a flp0.a flp1.a flp1.a flp1.a flp1.a e o .
flp0.a flp0.a flp1.a flp0.a flp0.a flp0.a flp0.a flp0.a e space .
flp0.a flp1.a flp1.a flp1.a flp0.a flp1.a flp1.a flp1.a e w .
flp0.a flp1.a flp1.a flp0.a flp1.a flp1.a flp1.a flp1.a e o .
flp0.a flp1.a flp1.a flp0.a flp1.a flp1.a flp0.a flp0.a e l .
flp0.a flp1.a flp1.a flp1.a flp0.a flp0.a flp1.a flp0.a e r .
flp0.a flp1.a flp1.a flp0.a flp0.a flp1.a flp0.a flp0.a e d .
ra
zz
e This function takes a function and returns a function that repeats it 8 times .
dmakeloop8.
rn
fap fap fap
fap fap fap
fap fap
rz
pz
zz
e This function takes a function and returns a function that repeats it 11 times .
dmakeloop11.
rn
fap fap fap fap
fap fap fap fap
fap fap fap
rz
pz
zz
e This function pops a bit off the input (passed by reference) and outputs it .
dprintstackbit.
cfpza
oa
rz
zz
e This function coordinates all the previous functions together (and is the entry point) .
dmain.
c flmakehelloworld.z a
c flmakeloop11. flmakeloop8. lprintstackbit. b
fba
rz
zz
[edit] Comments
Since there's no looping statement, recursion must be used. For this reason, it is recommended to implement at least some simple recursion optimisations, since otherwise long loops would generate more data on each iteration, eventually overflowing the implementation's stack.
This article isn't complete.

