GithubHelp home page GithubHelp logo

includealex / eo Goto Github PK

View Code? Open in Web Editor NEW

This project forked from objectionary/eo

0.0 0.0 0.0 7.85 MB

EOLANG, an Experimental Object-Oriented Programming Language Based on 𝜑-calculus

Home Page: https://www.eolang.org

License: MIT License

Java 69.95% Groovy 0.55% XSLT 17.82% TeX 11.28% ANTLR 0.23% Makefile 0.18%

eo's Introduction

logo

EO principles respected here DevOps By Rultor.com We recommend IntelliJ IDEA

mvn-linux PDD status Maintainability Maven Central codecov Hits-of-Code Lines of code License FOSSA Status Codacy Badge Known Vulnerabilities Code Smells

EO (stands for Elegant Objects or ISO 639-1 code of Esperanto) is an object-oriented programming language based on φ-calculus. We're aware of popular semi-OOP languages and we don't think they are good enough, including Java, Ruby, C++, Smalltalk, Python, PHP, C#: all of them have something we don't tolerate.

EO is not planning to become a mainstream language—this is not what we want. Our main goal is to prove to ourselves that true object-oriented programming is practically possible. Not just in books and abstract examples, but in real code that works. That's why EO is being created—to put all that "crazy" pure object-oriented ideas into practice and see whether they can work.

These things we don't tolerate:

  • types (why?)
  • static/class methods or attributes (why?)
  • classes (why?)
  • implementation inheritance (why?)
  • mutability (why?)
  • NULL (why?)
  • global scope (why?)
  • type casting (why?)
  • reflection (why?)
  • scalar types and data primitives
  • annotations (why?)
  • operators
  • traits and mixins (why?)
  • flow control statements (for, while, if, etc)
  • syntactic sugar (why?)

Quick Start

First, install Java SE, npm, and eoc.

Then, start with a simple EO program in app.eo file:

[args...] > app
  QQ.io.stdout > @
    "Hello, world!\n"

Compile it like this (may take a minute or so):

$ eoc link

Then, run it:

$ eoc --alone dataize app

You should see "Hello, world!" printed.

Simple Tutorial

In the example above, we create a new abstract object named app, which has got a single attribute named @. The object attached to the attribute @ is a copy of the object stdout with a single argument "Hello, world!". The object stdout is also abstract. It can't be used directly, a copy of it has to be created, with a few requirement arguments provided. This is how a copy of the object stdout is made:

QQ.io.stdout
  "Hello, world!"

The indentation in EO is important, just like in Python. There have to be two spaces in front of the line in order to go to the deeper level of nesting. This code can also be written in a "horizontal" notation:

QQ.io.stdout "Hello, world!"

Moreover, it's possible to use brackets in order to group arguments and avoid ambiguity. For example, instead of using a plain string "Hello, world!" we may want to create a copy of the object stdout with a more complex argument: a copy of the object sprintf:

[] > app
  QQ.io.stdout > @
    QQ.txt.sprintf
      "Hello, %s!"
      "Jeffrey"

Here, the object sprintf is also abstract. It is being copied with two arguments: "Hello, %s!" and "Jeffrey". This program can be written using horizontal notation:

+alias org.eolang.io.stdout
+alias org.eolang.txt.sprintf

[] > app
  (stdout (sprintf "Hello, %s!" "Jeffrey")) > @

The special attribute @ denotes an object that is being decorated. In this example, the object app decorates the copy of the object stdout and through this starts to behave like the object stdout: all attributes of stdout become the attributes of the app. The object app may have its own attributes. For example, it's possible to define a new abstract object inside app and use it to build the output string:

[] > app
  QQ.io.stdout (msg "Jeffrey") > @
  [name] > msg
    QQ.txt.sprintf "Hello, %s!" name > @

Now, the object app has two "bound" attributes: @ and msg. The attribute msg has an abstract object attached to it, with a single "free" attribute name.

This is how you iterate:

[args...] > app
  memory 0 > x
  seq > @
    x.write 2
    while.
      x.lt 6
      [i]
        seq > @
          QQ.io.stdout
            QQ.txt.sprintf
              "%d x %d = %d\n"
              x
              x
              x.times x
          x.write
            x.plus 1
    TRUE

This code will print this:

2 x 2 = 4
3 x 3 = 9
4 x 4 = 16
5 x 5 = 25

Got the idea?

What's Next?

Join our Telegram group.

Read our blog, especially the section with recently published papers.

See the full collection of canonical objects: objectionary.

Take a look how we use EO as an Intermediary Representation (IR) in Polystat, a polyglot static analyzer.

Play with more examples here.

Read about integration with Maven, here.

How to Contribute

Fork repository, make changes, send us a pull request. We will review your changes and apply them to the master branch shortly, provided they don't violate our quality standards. To avoid frustration, before sending us your pull request please run full Maven build:

$ mvn clean install -Pqulice

You will need Maven 3.3+ and Java 8+ installed.

eo's People

Contributors

yegor256 avatar graur avatar rultor avatar andreoss avatar mximp avatar yasamprom avatar l3r8yj avatar eugenedar avatar renovate[bot] avatar olesiasub avatar g4s8 avatar includealex avatar karina5005 avatar marceloamadeu avatar baudoliver7 avatar ingeniariussoftware avatar volodya-lombrozo avatar alex-semenyuk avatar dours avatar nqafield avatar levbagryansky avatar nikololiahim avatar snyk-bot avatar anisimova5005 avatar simonharmonicminor avatar mikhaillipanin avatar fabriciofx avatar maxonfjvipon avatar stain avatar sitiritis 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.