-
-
Notifications
You must be signed in to change notification settings - Fork 9
Home
- Command Line Usage
- Data Types
- Expressions
- Statements
- Functions
- Structures and Records
- Classes
- Unions
- Enums
- Aliases
- Function Aliases
- Namespaces
- Methods
- Expression Definitions
- Global Variables
- Memory Management
- Conditionals
- File Imports
- Function Pointers
- Pragma Directives
- Preprocessor
- Type Casting
- Comments
- Scope Rules
- Intrinsic Procedures
- Runtime Type Information
- Foreign Function Interface
- Package Manager
- Standard Library
Language:
-
Added ability to mark types as no discard using the
exhaustivekeyword:func getName() exhaustive String = "Not using this return value is a compile-time error"
-
Added ability to mark functions as disallowed using
= delete-
func youCannotCallThisFunction(a, b int) int = delete -
func youCannotCallThisFunction(a, b int) int = delete { return a + b } -
Trying to call a disallowed function is a compile-time error.
-
Trying to assign a type regularly that has
__assign__disallowed is a compile-time error.func __assign__(this *UnassignableType, _other POD UnassignableType) = delete
-
-
Unreachable code paths are no longer required to return a value
-
Added better and consistent constructors, with the new
constructorkeywordstruct Rectangle (w, h float) { constructor(w, h float) { this.w = w this.h = h } constructor(size float) { this.__constructor__(size, size) } } func main { rectangle1 Rectangle(100, 50) rectangle2 Rectangle = Rectangle(75, 50) rectangle3 Rectangle rectangle3.__constructor__(500) rectangle4 *Rectangle = new Rectangle(640, 480) defer delete rectangle4 }- Constructors automatically generate a constructor function (that has the same name as the type it's for)
- Constructors come with a companion
__constructor__method, which can be used to call a constructor on any value - Constructors can use the new immediate construction syntax:
my_value MyType()andnew MyType() - Zero-initialization is still the default, constructors don't apply to naked definitions, e.g.
my_value MyTypeis zero-initialized and not constructed.
-
Trying to declare
__as__as a method is now a compile-time error (__as__should be declared as a function) -
Changed
#haltdirective to exit the compiler with status code 1 instead of 0 -
Added
#donedirective to exit the compiler with status code of 0 -
Added
#runtime_resourcedirective, which will create a project-local copy of a file (if one with the same name doesn't already exist)- Used to automatically supply runtime resources such as
.dllfiles to new projects that need them
- Used to automatically supply runtime resources such as
-
Added classes, which are equivalent to structs except that they allow for virtual dispatch and come with a
__vtable__field.import basics class Shape () { constructor {} } func main { shape *Shape = new Shape() defer delete shape print(shape.__vtable__) // Will be non-zero since `value` is constructed and ready for dynamic dispatch }- All classes require a constructor and must be constructed in order to use dynamic dispatch / virtual methods
-
Added virtual methods and virtual dispatch
import basics class Shape () { constructor {} virtual func getArea() float { return 0.0f } } class Rectangle extends Shape (w, h float) { constructor(w, h float) { this.w = w this.h = h } override func getArea() float { return this.w * this.h } } func main { shape *Shape = new Rectangle(100.0f, 50.0f) defer delete shape print(shape.getArea()) }- Virtual methods can be used alongside existing features such as regular polymorphism, default values, and more
-
Added optional
foreignprefix for enums, which disables the requirement to use theEnumName::prefix to refer to enum variants. This is useful when writing bindings for C libraries, as enum variants are already named to be unambiguous.// ... foreign enum CURLUPart ( CURLUPART_URL, CURLUPART_SCHEME, CURLUPART_USER, CURLUPART_PASSWORD, CURLUPART_OPTIONS, CURLUPART_HOST, CURLUPART_PORT, CURLUPART_PATH, CURLUPART_QUERY, CURLUPART_FRAGMENT, CURLUPART_ZONEID /* added in 7.65.0 */ ) func main { // Without `foreign` prefix, we would have to do: part1 CURLUPart = CURLUPart::CURLUPART_URL // With `foreign` prefix, we're allowed to do: part1 CURLUPart = CURLUPART_URL } -
Resolved issues with loose polymorphism
-
$Tand$~Tare no longer equivalent-
$Tand$~Tare now only equivalent if at the top level of a type. For example,func add(a, b $T) $Tis equivalent tofunc add(a $T, b $~T) $T, butfunc add(a, b <$T> Container) <$T> Containeris not equivalent tofunc add(a <$T> Container, b <$~T> Container) <$T> Container.
-
-
-
Added new polymorphic prerequisite
$T extends MyClass, e.g.func useShape(shape <$T extends Shape> Optional) { ... } -
Changed
__unix__to now properly betruewhen compiling for macOS -
Lots of bugs fixes
Standard Library:
- Removed outdated lowercase constructors for types in
2.7/standard library-
array(items, length)removed in favor ofArray(items, length) -
list(items, length, ownership)removed in favor ofList(items, length, ownership) -
string(null_terminated_string)removed in favor ofString(null_terminated_string) -
captColor(r, g, b, a)removed in favor ofCaptColor(r, g, b, a) - etc.
- Outdated programs that use these old constructor names will need to have an earlier version of the standard library specified in order to compile (e.g. with
--std=2.6orpragma default_stdlib '2.6'or havepragma compiler_version '2.6')
-
- Some types such as
Pairare now records instead of plain structs - Trying to use a donor
String,List, orGridvalue after it has been donated now is now a runtime error (enabled by default) -
StringOwnership::DONATEDhas been renamed toStringOwnership::DONOR - Added
give()method forString,List, andGrid, which is equivalent tocommit()with ownership required. Not having ownership to give is a runtime error by default. - Added
__assign__for Optional, so that their internal values are not improperly assigned whenhasis false
Behind the Scenes Changes:
- Completely rewrote lexer
- Cleaner compiler code
Language:
- Added records
record Person (firstname, lastname String) - Added first class support for
[]fixed array syntax - Added support for compile-time dynamically sized fixed arrays
fixed_array [count] int - Pointless
__defer__functions are no longer generated, while also maintaining backwards compatibility - Automatic generation for
__assign__functions when applicable - Global data now works properly when using
WinMainas entry point - Added
pragma windowedand--windowedoptions to disable the opening of the command prompt on Windows - Added
__pod__and__assign__polymorphic prerequisites - Condition-less blocks
- Changed
$Tpolymorphs to always allow built-in auto conversions (equivalent to$~Tin previous versions)
Standard Library:
- Added
applyDefer(this *<$T> Array) voidto2.7/Array.adept - Added buffer-overflow protection in the implementation of parts of the standard library
Language:
- Removed
using namespace - Now supports new macOS M1 chip arm64 architecture
- Added support for anonymous structs/unions
- Added support for anonymous structs/unions as unnamed fields
- Added
typenameof $Texpression - Added
embed "filename.txt"expression - Added ability to rename
idxinrepeatloops viausing my_idx - Added null
ubyteliteral'\0'ub - Added support for chained methods as statements -
thing1().thing2().thing3() - Completed runtime type information for complex composite types
- Added new transcendent variables
__compiler_major__,__compiler_minor__,__compiler_release__, and__compiler_version_name__ - Changed
__compiler_version__to be a number instead of a string (__compiler_version_name__now exists for string version) - Added
alignof Typeexpression - Package manager now included
- Lots of bug fixes
Standard Library:
- Fixed an issue with
2.x/captain.adepton HDPI displays. Solution was back-ported to earlier versions - Fixed an issue in
2.4/aabb.adept - Added more math definitions in
2.7/cmath.adept - Changed
2.7/*to use newtypenameof $Texpression instead of RTTI when possible - Added
unix/sys/time.adept - Added new helper functions in
2.7/captain.adept - Added new method
clone(this *<*$P> List) <*$P> Listin2.7/List.adept - Added basic JSON parser
2.7/JSON.adept - Added more functionality for
2.7/Matrix4f.adeptand2.7/Vector3f.adept - Fixed an issue in
2.x/Optional.adept - Added stuff to
stb/image.adept - Added unique pointer type
2.7/Unique.adept - Added generic grid data-structure
2.7/Grid.adept - Added new user utility functions for
2.7/captain.adept - Added native libraries for Mach-O arm64
- Added experimental WebAssembly target
- Added new method
join(this *<String> List) Stringto2.7/parse.adept - Added meta variables
__arm64__,__x86_64__, and__wasm__ - Upgraded warning guard in
sys/cfloat.adept
- Added namespaces
- Added initializer lists
- Added
__as__management function - Added
~>operator - Added polycount variables
$#N - Added static variables
- Added alternative syntax choices
- Added better syntax for constant expressions
- Added ability to have scoped constant expressions
- Added new way to pass variadic arguments using VariadicArray
- Added function aliases
- Added
--entryandpragma entry_point - Added
sizeof(value)expression - Reduced size of resulting executable
- Made switch statement cases less picky
- Added built-in compile-checks for
printf(String, args ...) - Added simple unions
- Added polymorph that matches convertable types
$~Tof$T - Added ability to use
++and--on floating point types - Changed integer values of unspecified type to collapse to type
longinstead ofint - Added
#define - Added cross-compilation for Windows from MacOS
- Changed warnings to print code fragments
- Added
--short-warningsandpragma short_warningsto disable code fragments for warnings - Added
#errorand#warning - Added
-Werrorandpragma warn_as_errorto treat compiler warnings as errors - Added
nullmeta value - Added
--ignore-unusedandpragma ignore_unusedto ignore unused variable warnings - Added prototype REPL
- Added
exhaustivekeyword to force switch statements to account for all values of an enum - Added ability to specify default argument values
- Added
.sizefield toAnyTypetypes - Added support for C-style variadic arguments via
va_start,va_end,va_argandva_copy - Added
__access__management function - Added
__stdlib__dynamic compile-time meta variable - Added
-std=2.5andpragma default_stdlibto set default standard library - Added
import my_componentsyntax to import from the standard library - Improved
--versionhuman friendliness - Added
--ignore-*compiler flags andpragma ignore_pragma directives - Improved compilation performance
- Improved error and warning message format
- Cross-Compilation from MacOS to Windows with
--windows - Fix some bugs
- Fernando Dantas