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

Bad support for OOP libraries :( #70

Open
winterwolf opened this issue Nov 8, 2020 · 0 comments
Open

Bad support for OOP libraries :( #70

winterwolf opened this issue Nov 8, 2020 · 0 comments
Labels
enhancement New feature or request

Comments

@winterwolf
Copy link

winterwolf commented Nov 8, 2020

Please, look at this short example:

local class = require "middleclass" ---@type MiddleClass

local Fruit = class("Fruit")

---@param color table
---@param size number
function Fruit:initialize(color, size)
  self.color = color --- Color comment.
  self.size = size --- Size comment.
end

I use MiddleClass library for OOP, but problem not exactly in this library, this is common issue.

Look, the good thing here is that we can describe class fields in constructor, so we no need to copy them in class descriptions. This is very nice.

But the bad thing and my actual issue is that when we create a new instance of class, like Fruit({1,0,0}, 1)
we don't get any hints about accepted arguments between brackets and I have no idea how to provide them.

I think, the best solution here is provide some describer for synonyms/shortcuts, like this:

---@shortcut class.new
---@shortcut class
function class:initialize(...)
end
@CppCXY CppCXY added the enhancement New feature or request label Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants