vrodedanya / naobi

Naobi language
https://vrodedanya.github.io/naobi/
MIT License
4 stars 0 forks source link

[FEATURE] Methods #22

Closed vrodedanya closed 2 years ago

vrodedanya commented 2 years ago

Is your feature request related to a problem? Please describe. Sometimes functions explicitly related to type. For example substr() is used for string. In current realization we always need to pass object like argument:

function getDouble(integer var) -> integer
{
    return var * 2;
}
...
integer var = 5;
integer d = getDouble(var);
...

Will be good if we can use function like a method for first object in arguments

Describe the solution you'd like

function getDouble(integer var) -> integer
{
    return var * 2;
}
...
integer var = 5;
integer d = var.getDouble();