-
Notifications
You must be signed in to change notification settings - Fork 169
Adding Classes to scarpet. #306
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I spent 1 hour learning how should max_heap actually work 🤣
The classes.scl is really great, I'll surely use it for my projects
So we cane actually make multiple different instances
Why do you need to copy the class? 👀 |
Because otherwise you end up just having 1 map and so one object, instead of multiple instances of the same class of object. Taking a copy means that the original is unchanged and the |
BTW Im working on inheritance rn. It's not too hard and I've got it mostly working already, just need to figure out whether inheriting a class which already inherits from another class works or not. |
Ok so I've finished inheritance. I will be adding extensive documentation to Readme.md cos currently it's got like 1 line tbh. |
Gonna add an example to Readme.md soon
lol dumb mistake
I'm going to make all classes have a couple fundamental methods, which I will put into an |
cos deleting them is a pain in the ass
Too many changes, I didn't test last release
And description for method initialisation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at the code. I think this is good for what it is!
It looks thought out. I'm not seeing any obvious better approaches in the few minutes i've thought about it. (native built in scarpet classes might be nice, but also i wouldn't want to write that...)
using call()
for everything feels clunky, but thats how you have to do it.
I think large scripts are the once's that would benefit from this.
I remember bemoaning not having classes while writing the spellbook script.
Ill try this out more thoroughly if/when I rewrite it. (or any other larger scripts)
Still gotta figure out /script download stuff |
Yeah, I don't think the /script download stuff is so important, I'm just gonna put this up for review as it is, cos other stuff depends on it. |
This is a continuation from this discord conversation, and the code I wrote there.
In this PR, I also rename
heap.sc
tomin_heap.sc
, and addmax_heap.scl
as a showcase of what could be done with classes.NB: This PR should be Squashed and Merged, to avoid adding a bunch of useless commits to the history.
Todo: