Comments (11)
There's already a patch introduced for this type of function declaration, so this is likely something I can implement with minimal headache (but I could be wrong). As for properties, I will need to review the parser, but I imagine it can be done, but this may be redundant too since it plays no effect in the behavior of the table (you still create them with the create function). Not so sure about the struct keyword, appears redundant. After all, it's not a structure, it's just a table. And if I did implement it, it would just be skipped by the parser. So you could imagine.
But otherwise, suggestion seems nice. I'll keep ya posted.
from pluto.
I was already working on an implementation on my fork, what is the function declaration you are talking about?
from pluto.
I was already working on an implementation on my fork, what is the function declaration you are talking about?
http://lua-users.org/wiki/LuaPowerPatches
Ctrl + F "Function fields". Patched into Lua 5.2 already, so it may only need updating and credit.
Edit, link is down. Searched through the web server manually and got the file:
http://lua-users.org/files/wiki_insecure/jRhQ0hat/5.2/oofunc.diff
from pluto.
The reason why I am making a new keyword is because the functionality it intends to abstract over is not just a table/function, it's also the setmetatable function calls, and the indexing. It would be ambiguous as just a table
from pluto.
Why would setmetatable be needed? And why would indexing need to change too?
from pluto.
It is the idomatic way of doing this paradigm. I also want to add a "private" attribute that is only valid in the struct declaration which would make it only available to methods in the struct. This would not make any sense outside of the struct declaration, and even in a regular table
from pluto.
That's about inheritance, which is fairly unrelated. Users can do this manually in their create
function, or whatever they decide to call it. Private is not possible.
from pluto.
Progress update,
https://github.com/well-in-that-case/Pluto/tree/0.3.0
from pluto.
Progress update,
Thank goodness, the lua parser was killing me
from pluto.
@Frityet https://pluto-lang.org/docs/New%20Features/Object-Oriented%20Programming
from pluto.
@Frityet pluto-lang.org/docs/New%20Features/Object-Oriented%20Programming
Yep! I have been folliwng this project closely, looks great
from pluto.
Related Issues (20)
- Private fields are order-sensitive
- Socket: Get remote address
- Exports return at block end HOT 3
- Failed to compile v0.9.1 on aarch64 linux. HOT 4
- Walrus operator regression with # operator
- Read of uninitialized variable
- New Warning: Attempted necromancy
- unreachable-code false-positive
- Better error message for invalid pipe operator syntax
- Lua header files cannot be included in a C project HOT 1
- Makefile with MinGW doesn't work (missing syslibs, etc.) HOT 2
- Get rid of LUA_USE_{POSIX,_LINUX} macros
- Requesting new feature 'async'. HOT 1
- Switch expression does not reset pinnedreg
- Switch statement parsing confusion
- Evaluation order of cases HOT 7
- Single fallthrough not allowed HOT 2
- Switch optimisation HOT 1
- Compatibility mode through executable name HOT 1
- segfault using string.dump and debug.getinfo HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pluto.