anoniscoding / yorlang

A programming language with yoruba language construct
https://anoniscoding.github.io/yorlang/
MIT License
450 stars 70 forks source link

Working with Objects #45

Closed mykeels closed 5 years ago

mykeels commented 5 years ago

Adds ability to work with objects into the language.

Ebi (objects)

ebi is family, which represents an object, and it can be used like:

jẹ́kí person = ebi(
    "name", "bisi"
);

to create an object like { name: 'bisi' }, and can be nested like

jẹ́kí person = ebi(
    "name", "bisi",
    ebi(
        "age", 31
    )
);

to create { name: 'bisi', age: 31 }.

Omo (gets or sets an object's property)

ọmọ is child, which is used to get or set the property of an object. E.g.

ọmọ(person, "name");

using the object created above will return bisi.

and

ọmọ(person, "name", "kola");

will set the "name" property of the object to "kola" and return that instead.