Extending classes from the pkl standard library #478
emileakbarzadeh
started this conversation in
General
Replies: 1 comment
-
I think the issue is different, you can avoid that error by
The error I get is:
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi there, great work on pkl!
One pain point I've come across is that pkl does not allow you to extend base classes (such as set or listing) to add properties or functions
A use case I have for this is to be able to remove items from a set by some key.
Example below of my attempted code
Currently this results in an error because only open classes can extended.
Cannot extend non-open class Set.
Solutions
In Swift, for example, you can extend a closed class by using the
extension
keyword. Perhaps it could be possible to add this to the language, or is there something I'm missing here?Thanks for your time!
Beta Was this translation helpful? Give feedback.
All reactions