You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: paper.tex
+33-19Lines changed: 33 additions & 19 deletions
Original file line number
Diff line number
Diff line change
@@ -28,7 +28,7 @@
28
28
\begin{abstract}
29
29
C++, Java, C\#, Python, Ruby, and JavaScript are the most powerful object-oriented programming languages if language power is defined as the number of \emph{features} available to a programmer.
30
30
\eolang{}, on the other hand, is an object-oriented programming language with a reduced set of features: it has nothing but objects and mechanisms of their composition and decoration.
31
-
We are trying to answer the following research question: ``Which known features are possible to implement using only objects?''
31
+
This paper asks the following research question: ``Which known features are possible to implement using only objects?''
32
32
\end{abstract}
33
33
34
34
\begin{document}
@@ -38,7 +38,7 @@
38
38
39
39
\section{Features}
40
40
41
-
To answer our research question we selected the most complex features and demonstrated how each of them may be represented in \eolang{}~\citep{bugayenko2021eolang} objects\footnote{%
41
+
We selected the most complex features and demonstrated how each of them may be represented in \eolang{}~\citep{bugayenko2021eolang} objects\footnote{%
the rendered version is \href{https://github.com/REPOSITORY/releases/tag/0.0.0}{\ff{0.0.0}}.}:
@@ -83,7 +83,8 @@ \section{Features}
83
83
\subsection{Goto}
84
84
\label{sec:goto}
85
85
86
-
Goto is a one-way imperative transfer of control to another line of code. There are only two possible cases of goto jumps: forward and backward.
86
+
Goto is a one-way imperative transfer of control to another line of code.
87
+
There are only two possible cases of goto jumps: forward and backward.
87
88
88
89
\subsubsection{Backward Jump}
89
90
@@ -121,7 +122,7 @@ \subsubsection{Backward Jump}
121
122
\end{ffcode}
122
123
123
124
Here, the one-argument abstract atom \ff{go.to} is being copied with a one-argument abstract anonymous object, which is a sequence of objects incrementing \ff{i} and then comparing it with the number ten.
124
-
If the condition is true, \ff{g.backward} is called, which leads to a backward jump and re-iteration of \ff{go.to}.
125
+
If the condition is true, \ff{backward} is called, which leads to a backward jump and re-iteration of \ff{go.to}.
125
126
126
127
\subsubsection{Forward Jump}
127
128
@@ -158,7 +159,7 @@ \subsubsection{Forward Jump}
158
159
\end{ffcode}
159
160
160
161
Here, the same abstract atom \ff{go.to} is copied with an abstract one-argument object that is a sequence of objects.
161
-
When the condition is true, a forward jump is performed by \ff{g.forward} atom.
162
+
When the condition is true, a forward jump is performed by \ff{forward} atom.
162
163
163
164
Similarly, the atom \ff{go.to} may be used to simulate other conditional jump statements, like \ff{break}, \ff{continue}, or \ff{return} in the middle of a function body (see \cref{sec:procedures}).
164
165
@@ -205,7 +206,7 @@ \subsubsection{Complex Case}
205
206
206
207
Then, the translation to \eolang{} is trivial using the \ff{go.to} object.
207
208
208
-
In more complex cases, a program may first be restructured to replace \ff{goto} statements with loops and branching, as suggested by~\citet{williams1985restructuring,pan1996formal,erosa1994taming,ceccato2008goto}.
209
+
In more complex cases, a program may first be restructured to replace \ff{goto} statements with loops and branching, as suggested by\citet{williams1985restructuring,pan1996formal,erosa1994taming,ceccato2008goto}.
The dataization of \ff{g.forward} will exit the \ff{go.to} object wrapping the entire code in the ``function''\ff{abs}.
239
+
The dataization of \ff{forward} will exit the \ff{go.to} object wrapping the entire code in the ``function''\ff{abs}.
239
240
240
241
\subsection{Pointers}
241
242
\label{sec:pointers}
@@ -286,13 +287,19 @@ \subsubsection{Pointers to Data}
286
287
b.price
287
288
\end{ffcode}
288
289
289
-
Here, \ff{p1} is an object that can be used as an argument of \ff{f}. It is a copy of an abstract object \ff{heap.pointer}, which expects two parameters: 1)~an absolute address in memory and 2)~the size of the memory block it points to, in bytes. Its attribute \ff{block} expects two attributes: 1)~the number of bytes in the heap and 2)~an abstract object that can encapsulate \ff{bytes} that were just read from memory.
290
+
Here, \ff{p1} is an object that can be used as an argument of \ff{f}.
291
+
It is a copy of an abstract object \ff{heap.pointer}, which expects two parameters:
292
+
1)~an absolute address in memory
293
+
and
294
+
2)~the size of the memory block it points to, in bytes.
295
+
Its attribute \ff{block} expects two attributes: 1)~the number of bytes in the heap and 2)~an abstract object that can encapsulate \ff{bytes} that were just read from memory.
290
296
291
297
The object \ff{heap} is an abstraction of a random access memory.
292
298
293
299
\subsubsection{Pointers to Code}
294
300
295
-
A pointer may not only refer to data in the heap but also to executable code in memory (there is no difference between ``program'' and ``data'' memory in both x86 and ARM architectures). This is an example of a C program that calls a function referenced by a function pointer, providing two integer arguments to it:
301
+
A pointer may not only refer to data in the heap but also to executable code in memory (there is no difference between ``program'' and ``data'' memory in both x86 and ARM architectures).
302
+
This is an example of a C program that calls a function referenced by a function pointer, providing two integer arguments to it:
296
303
297
304
\begin{ffcode}
298
305
int foo(int x, int y) {
@@ -364,12 +371,15 @@ \subsubsection{Variables in Stack}
364
371
ret
365
372
\end{ffcode}
366
373
367
-
Here, the atom \ff{malloc} allocates a segment of bytes in the \ff{heap}. Later, the atom \ff{free} releases it. The attribute \ff{ret} is made constant to avoid its recalculation after it is ``returned'' (this mechanism is explained in \cref{sec:destructors} where destructors are discussed).
374
+
Here, the atom \ff{malloc} allocates a segment of bytes in the \ff{heap}. Later, the atom \ff{free} releases it.
375
+
The attribute \ff{ret} is made constant to avoid its recalculation after it is ``returned'' (this mechanism is explained in \cref{sec:destructors} where destructors are discussed).
368
376
369
377
\subsection{Procedures}
370
378
\label{sec:procedures}
371
379
372
-
A subroutine is a sequence of program instructions that performs a specific task, packaged as a unit. In different programming languages, a subroutine may be called a routine, subprogram, function, method, or procedure. In this PHP example, a function \ff{max} is defined:
380
+
A subroutine is a sequence of program instructions that performs a specific task, packaged as a unit.
381
+
In different programming languages, a subroutine may be called a routine, subprogram, function, method, or procedure.
382
+
In this PHP example, a function \ff{max} is defined:
373
383
374
384
\begin{ffcode}
375
385
function max($a, $b) {
@@ -398,9 +408,8 @@ \subsection{Impure Functions}
398
408
399
409
\broken
400
410
401
-
A function is pure when, among other qualities, it does not have side effects:
402
-
no mutation of local static variables, non-local variables, mutable reference arguments,
403
-
or input/output streams. This PHP function is impure:
411
+
A function is pure when, among other qualities, it does not have side effects: no mutation of local static variables, non-local variables, mutable reference arguments, or input/output streams.
412
+
This PHP function is impure:
404
413
405
414
\begin{ffcode}
406
415
$a = 42;
@@ -428,7 +437,8 @@ \subsection{Classes}
428
437
429
438
\broken
430
439
431
-
A class is an extensible program code template for creating objects, providing initial values for state (member variables) and implementations of behavior (member functions or methods). The following program contains a Ruby class with a single constructor, two methods, and one mutable member variable:
440
+
A class is an extensible program code template for creating objects, providing initial values for state (member variables) and implementations of behavior (member functions or methods).
441
+
The following program contains a Ruby class with a single constructor, two methods, and one mutable member variable:
432
442
433
443
\begin{ffcode}
434
444
class Book
@@ -461,7 +471,8 @@ \subsection{Classes}
461
471
id.write i > @
462
472
\end{ffcode}
463
473
464
-
Here, the constructor is represented by the object \ff{ruby-init}, which finishes the initialization of the object. Making an ``instance'' of a book would look like this:
474
+
Here, the constructor is represented by the object \ff{ruby-init}, which finishes the initialization of the object.
475
+
Making an ``instance'' of a book would look like this:
465
476
466
477
\begin{ffcode}
467
478
book 42 > b
@@ -475,7 +486,8 @@ \subsection{Destructors}
475
486
476
487
\broken
477
488
478
-
In C++ and some other languages, a destructor is a method that is called for a class object when that object passes out of scope or is explicitly deleted. The following code will print both \ff{Alive} and \ff{Dead} texts:
489
+
In C++ and some other languages, a destructor is a method that is called for a class object when that object passes out of scope or is explicitly deleted.
490
+
The following code will print both \ff{Alive} and \ff{Dead} texts:
479
491
480
492
\begin{ffcode}
481
493
#include <iostream>
@@ -509,7 +521,8 @@ \subsection{Destructors}
509
521
\subsection{Exceptions}
510
522
\label{sec:exceptions}
511
523
512
-
Exception handling is the process of responding to the occurrence of exceptions—anomalous or exceptional conditions requiring special processing—during the execution of a program. This C++ program utilizes exception handling to avoid segmentation fault due to null pointer de-referencing:
524
+
Exception handling is the process of responding to the occurrence of exceptions—anomalous or exceptional conditions requiring special processing—during the execution of a program.
525
+
This C++ program utilizes exception handling to avoid segmentation fault due to null pointer de-referencing:
513
526
514
527
\begin{ffcode}
515
528
#include <iostream>
@@ -554,7 +567,8 @@ \subsection{Exceptions}
554
567
555
568
Here, the object \ff{try} expects three arguments: 1)~an abstract object to be dataized, 2)~an abstract object to be copied with one argument, in case dataization returns an encapsulated object, and 3)~an object to be dataized anyway (similar to Java \ff{finally} block).
556
569
557
-
In the object \ff{price}, we get the object \ff{error}, which, if dataized, causes the termination of dataization and a non-conditional jump to the ``catch'' object of the \ff{try}. The mechanism is similar to ``checked'' exceptions in Java, where a method's signature must declare all types of exceptions the method may throw.
570
+
In the object \ff{price}, we get the object \ff{error}, which, if dataized, causes the termination of dataization and a non-conditional jump to the ``catch'' object of the \ff{try}.
571
+
The mechanism is similar to ``checked'' exceptions in Java, where a method's signature must declare all types of exceptions the method may throw.
0 commit comments