Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove prototypes? #95

Open
Rohansi opened this issue Aug 7, 2021 · 0 comments
Open

Remove prototypes? #95

Rohansi opened this issue Aug 7, 2021 · 0 comments
Labels

Comments

@Rohansi
Copy link
Owner

Rohansi commented Aug 7, 2021

Maybe slightly controversial but prototypes and the baggage that comes with it adds a lot of overhead. Do we really need it? We can embrace a more functional style instead of "OOP" that works like old JS. There's already no class syntax and I kind of doubt there's significant OOP code written in Mond anyway.

The challenge is without types and overloading we'd need to have uniquely named function or namespace them under an object. For example, consider all the builtin prototypes for strings, arrays, etc. We need to be able to get the length of strings and arrays, so we could have a generic length function or could have String.length and Array.length instead.

Alternatively maybe we can go down the Lua route a bit with the : operator. It's kind of similar to the |> operator we already have where it transforms x.y(z) into x.y(x, z) (while only evaluating x once). However we wouldn't have a separate operator for that I think... kind of like universal function call syntax.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant