Skip to content

Implement interface support - #473

Open
nykwono wants to merge 4 commits into
FunkinCrew:developfrom
nykwono:full-interface-support
Open

Implement interface support#473
nykwono wants to merge 4 commits into
FunkinCrew:developfrom
nykwono:full-interface-support

Conversation

@nykwono

@nykwono nykwono commented Aug 20, 2026

Copy link
Copy Markdown

This PR implements full support for being able to use interfaces.

Contents:

  • Through a macro, you're able to have any scripted classes implement source code interfaces (For example: IScriptedClass from Funkin')
  • You're also able to your create own scripted interface to be used for any scripted class.
    • With this, you're also able to extend other interfaces (including base ones!) for your interface like in regular Haxe.
  • You're able to use Std.isOfType / is to check whether a field is a given interface (this includes fields of source code classes also, and checking for source code interfaces).

Limitations:

  • Because HScript isn't typed, unfortunately interfaces aren't type checked while checking if the class satisfies it. This would be hard to do manually because of HScript's limitations of not being typed. However, most of everything else is checked for (The interface field existing, it being the right kind, etc.).

@TechnikTil TechnikTil left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whatthehappy

@realvirtu

Copy link
Copy Markdown
Contributor
yellowbear

@nykwono
nykwono marked this pull request as ready for review August 21, 2026 04:11
@AbnormalPoof
AbnormalPoof force-pushed the full-interface-support branch from 3b48583 to d393747 Compare August 22, 2026 07:01
@AbnormalPoof
AbnormalPoof self-requested a review August 22, 2026 07:01
@nykwono
nykwono force-pushed the full-interface-support branch 2 times, most recently from 3b48583 to 00722a8 Compare August 25, 2026 12:40

@ahmed7p ahmed7p left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When interfaces extending normal interfaces the game crashes with the lime null object window with weird bug in the terminal with out crashlog and extending ScriptedInterfaces closes the game with out any error at all like the game just close no errors no log nothing it just close + implementing does nothing it's like doesn't do anything i used it i tried to get any of the errors of not having the funtion nothing shows i tried implementing Scripted and Source ones all the same so that's what i have

i don't see any other reviews (til didn't test it) so idk if it's only me

some screen shots

Image Image Image Image Image

@nykwono

nykwono commented Aug 25, 2026

Copy link
Copy Markdown
Author

The errors should be fixed now, appreciate you reporting them.

As for the last image of it not giving any errors, this is intentional in a sense. The interfaces start to give you errors only when trying to instantiate the class as that's when it tries to validate the interfaces. I was considering having it so it would give the errors nonetheless, but I felt that would be too much of a hassle trying to do though and most script class errors that happen in Polymod that are normally syntax errors in Haxe are thrown at runtime anyways. Not to mention the regular use case for interfaces are meant for class instances so nonetheless you are going to get the validation errors regardless lol.

Though, if someone else on the crew would rather want to request for that change I wouldn't mind trying to attempt it.

@ahmed7p ahmed7p left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok everything works good now

Image

@nykwono

nykwono commented Aug 26, 2026

Copy link
Copy Markdown
Author

Pushed a final fix relating to validating interfaces since i accidentally fucked it up but the PR should be fully good now!

@nykwono
nykwono force-pushed the full-interface-support branch 2 times, most recently from 2b5eb65 to 31fef02 Compare August 30, 2026 21:13
@AbnormalPoof
AbnormalPoof force-pushed the full-interface-support branch from d8b3dbf to 6a15058 Compare September 8, 2026 20:04
@TechnikTil

Copy link
Copy Markdown
Contributor

This PR has merge conflicts...

@nykwono
nykwono force-pushed the full-interface-support branch from 6a15058 to ce81490 Compare September 8, 2026 21:39
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

Successfully merging this pull request may close these issues.

4 participants