charly-lang / charly

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

Allow passing arguments by reference #26

Closed PascalLuginbuehl closed 7 years ago

PascalLuginbuehl commented 7 years ago

When creating a function, option to give parameters as reference or by value 👍

KCreate commented 7 years ago

Implementation proposal:

func increment(&value) { ... };

A & sign before an argument identifier signifies that it should be passed by reference. This requires a new node to be added to the AST (ReferencedIdentifier). The Container class has the ability to return a reference to a variable.

This will be included in Release 0.0.2

👍

KCreate commented 7 years ago

Implemented partially on the master branch