Tags
Creators
Details
1.4.0-pre1
Compatibility
Changes
Inheritance pre-release
This update took a while to come out with and involved a lot of technical challenges which had to be overcome. The previous major update (1.3.0) addressed a lot of the core internal differences between the two branches, but I feel it's necessary to do this as a pre-release first to iron out bugs and make testing more accessible to those who want to.
Feedback, suggestions and bug reports for the update are welcome! Especially if you have any issues with the language design now is a good time to voice them so we can discuss before it's committed to a full release. If so please make an issue or contact me on discord! (@novystar) You can also leave a comment on the current inheritance PR #5 which will remain unmerged until the full release.
Additions:
- Single class inheritance
- New modifiers:
protected- Restricted to subclasses and field definitions innew Classsectionsoverride- In order to override a method you need to use this or you'll get an error.abstract- Abstract classes can be extended directly in code anonymously, they may also contain abstract methods which have no body and must be implemented by any inheritor.final- Final classes can't be extended, final methods can't be overridden.
- Super method calls like
super::method(), for accessing the non-overridden version of a method (from the previous class). - Anonymous classes: abstract classes can be implemented directly in the
new instancesection (anonymous behaviour is erased on restart) - A dedicated 'cast' expression for upcasting in strictly typed scenarios (like using type hints):
{_var} as MyClass
Changes/fixes:
- The
instance ofcondition now supportsexact instance offor direct comparisons. - Removed the
belongs topattern for class comparisons
See the following wiki pages for a more in depth walk through of the new features for this update:
Projects on Modrinth are automatically available through a Maven repository for use with JVM build tools such as Gradle. To learn more about the Modrinth Maven API, click here.
Note: When available, you should use the creator's maven repo instead as it will have transitive dependency information that the Modrinth Maven API does not. You may also end up with duplicate dependencies if you use a mix of Modrinth and non-Modrinth Maven repositories for your dependencies, because the group identifier will be different when served through the Modrinth Maven API.
Maven coordinates:
Version ID:
build.gradle:
repositories {
exclusiveContent {
forRepository {
maven {
name = "Modrinth"
url = "https://api.modrinth.com/maven"
}
}
// forRepositories(fg.repository) // Uncomment when using ForgeGradle
filter {
includeGroup "maven.modrinth"
}
}
}
// Standard Gradle dependency
dependencies {
implementation "maven.modrinth:DL6BwgfK:diOAYrh5"
}
// Legacy Loom dependency
dependencies {
modImplementation "maven.modrinth:DL6BwgfK:diOAYrh5"
}
