charly-lang / charly

🐈 The Charly Programming Language | Written by @KCreate
https://charly-lang.github.io/charly/
MIT License
199 stars 10 forks source link

Container #42

Closed KCreate closed 7 years ago

KCreate commented 7 years ago

Implement container syntax

container MyNewContainer {
    let myName = "Leonard";
};

print(MyNewContainer.myName); # "Leonard"

Container just act like immediately initialized class expressions. There will be no constructor inside container.

KCreate commented 7 years ago

Anonymous containers

... are containers you can write via the following syntax:

let myContainer = {
    let name = "hello";
};
print(myContainer.name); # "hello"

let myContainer = {
    let info = {
        let age = 16;
    };
};
print(myContainer.info.age); # 16
KCreate commented 7 years ago

Implemented in #54