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

Bug Report: no way to deal with class name collisions in scripts #4117

Open
3 tasks done
cyn0x8 opened this issue Feb 8, 2025 · 3 comments
Open
3 tasks done

Bug Report: no way to deal with class name collisions in scripts #4117

cyn0x8 opened this issue Feb 8, 2025 · 3 comments
Labels
status: pending pull request Dependent on a pull request that is currently awaiting review. topic: mods Related to the creation or use of mods. type: minor bug Involves a minor bug or issue.

Comments

@cyn0x8
Copy link
Contributor

cyn0x8 commented Feb 8, 2025

Issue Checklist

  • I have read the pinned Issues Guide
  • I have checked the Issues/Discussions pages to see if my issue has already been reported
  • I have properly named my issue

Platform

Compiled from GitHub Source Code

Browser

None

Version

0.5.3

Description (include any images, videos, errors, or crash logs)

there currently doesnt seem to be a way to handle class name collisions in a script
import aliases dont work because the script syntax errors on as and prefixing the class with its package also syntax errors

this might be a bug of interest considering the "static hscript" thing eric was working on!!

Steps to Reproduce

No response

@cyn0x8 cyn0x8 added status: pending triage Awaiting review. type: minor bug Involves a minor bug or issue. labels Feb 8, 2025
@AbnormalPoof AbnormalPoof added the topic: mods Related to the creation or use of mods. label Feb 8, 2025
@EliteMasterEric EliteMasterEric added status: planned Planned to be implemented some time in the future. and removed status: pending triage Awaiting review. labels Feb 13, 2025
@EliteMasterEric
Copy link
Member

This would be solved by adding support for import aliases via the as keyword.

Also, reading the title I thought this was related to multiple different HScript files defining the same class name, which SHOULD throw an error but I can't remember if it does at the moment.

@cyn0x8
Copy link
Contributor Author

cyn0x8 commented Feb 14, 2025

Also, reading the title I thought this was related to multiple different HScript files defining the same class name, which SHOULD throw an error but I can't remember if it does at the moment.

just tested it out and it doesnt error, but seems to just replace the class in a certain order

mod name (descending) -> num of subdirectories (descending) -> dir name (ascending) -> file name (ascending)





however this can be mitigated by using package !!





buuuut this fails if relative paths and filenames are the same
(also happens to assets and ids, this is why regardless currently i put them in an extra directory like images/exampleMod/ and scripts/exampleMod/, and prefix song/stages/character ids like exampleMod.exampleSong and exampleMod.exampleStage and exampleMod.exampleCharacter)





idk if this is intended behavior or not...

@EliteMasterEric
Copy link
Member

The intended behavior is that if two modules have the same name and package as each other (regardless of directory), an error will be thrown and only the first module that was detected will apply until a fix is applied.

@AbnormalPoof AbnormalPoof added status: pending pull request Dependent on a pull request that is currently awaiting review. and removed status: planned Planned to be implemented some time in the future. labels Feb 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: pending pull request Dependent on a pull request that is currently awaiting review. topic: mods Related to the creation or use of mods. type: minor bug Involves a minor bug or issue.
Projects
None yet
Development

No branches or pull requests

3 participants