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

how to define subclass in *.d.tl #173

Closed
cloudfreexiao opened this issue Jun 15, 2020 · 2 comments
Closed

how to define subclass in *.d.tl #173

cloudfreexiao opened this issue Jun 15, 2020 · 2 comments

Comments

@cloudfreexiao
Copy link
Contributor

cloudfreexiao commented Jun 15, 2020

some code like this how to define the Lemon type ?

local Fruit = record
end

-- Lemon is Fruit subclassing 
local Lemon = record
end
@cloudfreexiao cloudfreexiao changed the title how to define class how to define subclass in *.d.tl Jun 15, 2020
@pdesaulniers
Copy link
Member

Currently, there is no mechanism for this. However, this PR implements tagged records, which may be used to create subtypes:

local Fruit = record
   tag fruit_type: string
end

local Lemon = record is Fruit with fruit_type = "lemon"
end

@hishamhm
Copy link
Member

Let's close this as a duplicate of #97, to avoid having the same topic spread across various issues. @cloudfreexiao See you there!

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

No branches or pull requests

3 participants