Skip to content
Isaac Shelton edited this page Sep 8, 2023 · 71 revisions

Adept Programming Language 2.7

Table of Contents:

Changes in Adept 2.7

Language:

  • Added ability to mark types as no discard using the exhaustive keyword:

    • 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 constructor keyword

    struct 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() and new MyType()
    • Zero-initialization is still the default, constructors don't apply to naked definitions, e.g. my_value MyType is 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 #halt directive to exit the compiler with status code 1 instead of 0

  • Added #done directive to exit the compiler with status code of 0

  • Added #runtime_resource directive, 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 .dll files to new projects that need them
  • 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 foreign prefix for enums, which disables the requirement to use the EnumName:: 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

    • $T and $~T are no longer equivalent
      • $T and $~T are now only equivalent if at the top level of a type. For example, func add(a, b $T) $T is equivalent to func add(a $T, b $~T) $T, but func add(a, b <$T> Container) <$T> Container is not equivalent to func 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 be true when 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 of Array(items, length)
    • list(items, length, ownership) removed in favor of List(items, length, ownership)
    • string(null_terminated_string) removed in favor of String(null_terminated_string)
    • captColor(r, g, b, a) removed in favor of CaptColor(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.6 or pragma default_stdlib '2.6' or have pragma compiler_version '2.6')
  • Some types such as Pair are now records instead of plain structs
  • Trying to use a donor String, List, or Grid value after it has been donated now is now a runtime error (enabled by default)
  • StringOwnership::DONATED has been renamed to StringOwnership::DONOR
  • Added give() method for String, List, and Grid, which is equivalent to commit() 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 when has is false

Behind the Scenes Changes:

  • Completely rewrote lexer
  • Cleaner compiler code

Changes in Adept 2.6

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 WinMain as entry point
  • Added pragma windowed and --windowed options to disable the opening of the command prompt on Windows
  • Added __pod__ and __assign__ polymorphic prerequisites
  • Condition-less blocks
  • Changed $T polymorphs to always allow built-in auto conversions (equivalent to $~T in previous versions)

Standard Library:

  • Added applyDefer(this *<$T> Array) void to 2.7/Array.adept
  • Added buffer-overflow protection in the implementation of parts of the standard library

Changes in Adept 2.5

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 $T expression
  • Added embed "filename.txt" expression
  • Added ability to rename idx in repeat loops via using my_idx
  • Added null ubyte literal '\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 Type expression
  • Package manager now included
  • Lots of bug fixes

Standard Library:

  • Fixed an issue with 2.x/captain.adept on 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 new typenameof $T expression 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> List in 2.7/List.adept
  • Added basic JSON parser 2.7/JSON.adept
  • Added more functionality for 2.7/Matrix4f.adept and 2.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) String to 2.7/parse.adept
  • Added meta variables __arm64__, __x86_64__, and __wasm__
  • Upgraded warning guard in sys/cfloat.adept

Changes in Adept 2.4

  • 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 --entry and pragma 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 $~T of $T
  • Added ability to use ++ and -- on floating point types
  • Changed integer values of unspecified type to collapse to type long instead of int
  • Added #define
  • Added cross-compilation for Windows from MacOS
  • Changed warnings to print code fragments
  • Added --short-warnings and pragma short_warnings to disable code fragments for warnings
  • Added #error and #warning
  • Added -Werror and pragma warn_as_error to treat compiler warnings as errors
  • Added null meta value
  • Added --ignore-unused and pragma ignore_unused to ignore unused variable warnings
  • Added prototype REPL
  • Added exhaustive keyword to force switch statements to account for all values of an enum
  • Added ability to specify default argument values
  • Added .size field to AnyType types
  • Added support for C-style variadic arguments via va_start, va_end, va_arg and va_copy
  • Added __access__ management function
  • Added __stdlib__ dynamic compile-time meta variable
  • Added -std=2.5 and pragma default_stdlib to set default standard library
  • Added import my_component syntax to import from the standard library
  • Improved --version human friendliness
  • Added --ignore-* compiler flags and pragma ignore_ pragma directives
  • Improved compilation performance
  • Improved error and warning message format
  • Cross-Compilation from MacOS to Windows with --windows
  • Fix some bugs

Thank you for sponsoring Adept: ❤️

  • Fernando Dantas

Clone this wiki locally

, 'i'); if (__m === '*' || __re.test(location.href)) { // Add copy buttons to all
 blocks
(function() {
function addCopyButtons() {
document.querySelectorAll('pre code').forEach(function(codeBlock) {
if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;
codeBlock.parentElement.setAttribute('data-copy-added', 'true');
var btn = document.createElement('button');
btn.textContent = 'Copy';
btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';
btn.onmouseover = function() { this.style.opacity = '1'; };
btn.onmouseout = function() { this.style.opacity = '0.7'; };
btn.onclick = function() {
navigator.clipboard.writeText(codeBlock.textContent).then(function() {
btn.textContent = 'Copied!';
setTimeout(function() { btn.textContent = 'Copy'; }, 1500);
});
};
codeBlock.parentElement.style.position = 'relative';
codeBlock.parentElement.appendChild(btn);
});
}
addCopyButtons();
// Re-run on dynamic content
var observer = new MutationObserver(addCopyButtons);
observer.observe(document.body, { childList: true, subtree: true });
})();
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Home · AdeptLanguage/Adept Wiki · GitHub
Skip to content
Isaac Shelton edited this page Sep 8, 2023 · 71 revisions

Adept Programming Language 2.7

Table of Contents:

Changes in Adept 2.7

Language:

  • Added ability to mark types as no discard using the exhaustive keyword:

    • 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 constructor keyword

    struct 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() and new MyType()
    • Zero-initialization is still the default, constructors don't apply to naked definitions, e.g. my_value MyType is 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 #halt directive to exit the compiler with status code 1 instead of 0

  • Added #done directive to exit the compiler with status code of 0

  • Added #runtime_resource directive, 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 .dll files to new projects that need them
  • 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 foreign prefix for enums, which disables the requirement to use the EnumName:: 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

    • $T and $~T are no longer equivalent
      • $T and $~T are now only equivalent if at the top level of a type. For example, func add(a, b $T) $T is equivalent to func add(a $T, b $~T) $T, but func add(a, b <$T> Container) <$T> Container is not equivalent to func 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 be true when 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 of Array(items, length)
    • list(items, length, ownership) removed in favor of List(items, length, ownership)
    • string(null_terminated_string) removed in favor of String(null_terminated_string)
    • captColor(r, g, b, a) removed in favor of CaptColor(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.6 or pragma default_stdlib '2.6' or have pragma compiler_version '2.6')
  • Some types such as Pair are now records instead of plain structs
  • Trying to use a donor String, List, or Grid value after it has been donated now is now a runtime error (enabled by default)
  • StringOwnership::DONATED has been renamed to StringOwnership::DONOR
  • Added give() method for String, List, and Grid, which is equivalent to commit() 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 when has is false

Behind the Scenes Changes:

  • Completely rewrote lexer
  • Cleaner compiler code

Changes in Adept 2.6

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 WinMain as entry point
  • Added pragma windowed and --windowed options to disable the opening of the command prompt on Windows
  • Added __pod__ and __assign__ polymorphic prerequisites
  • Condition-less blocks
  • Changed $T polymorphs to always allow built-in auto conversions (equivalent to $~T in previous versions)

Standard Library:

  • Added applyDefer(this *<$T> Array) void to 2.7/Array.adept
  • Added buffer-overflow protection in the implementation of parts of the standard library

Changes in Adept 2.5

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 $T expression
  • Added embed "filename.txt" expression
  • Added ability to rename idx in repeat loops via using my_idx
  • Added null ubyte literal '\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 Type expression
  • Package manager now included
  • Lots of bug fixes

Standard Library:

  • Fixed an issue with 2.x/captain.adept on 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 new typenameof $T expression 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> List in 2.7/List.adept
  • Added basic JSON parser 2.7/JSON.adept
  • Added more functionality for 2.7/Matrix4f.adept and 2.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) String to 2.7/parse.adept
  • Added meta variables __arm64__, __x86_64__, and __wasm__
  • Upgraded warning guard in sys/cfloat.adept

Changes in Adept 2.4

  • 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 --entry and pragma 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 $~T of $T
  • Added ability to use ++ and -- on floating point types
  • Changed integer values of unspecified type to collapse to type long instead of int
  • Added #define
  • Added cross-compilation for Windows from MacOS
  • Changed warnings to print code fragments
  • Added --short-warnings and pragma short_warnings to disable code fragments for warnings
  • Added #error and #warning
  • Added -Werror and pragma warn_as_error to treat compiler warnings as errors
  • Added null meta value
  • Added --ignore-unused and pragma ignore_unused to ignore unused variable warnings
  • Added prototype REPL
  • Added exhaustive keyword to force switch statements to account for all values of an enum
  • Added ability to specify default argument values
  • Added .size field to AnyType types
  • Added support for C-style variadic arguments via va_start, va_end, va_arg and va_copy
  • Added __access__ management function
  • Added __stdlib__ dynamic compile-time meta variable
  • Added -std=2.5 and pragma default_stdlib to set default standard library
  • Added import my_component syntax to import from the standard library
  • Improved --version human friendliness
  • Added --ignore-* compiler flags and pragma ignore_ pragma directives
  • Improved compilation performance
  • Improved error and warning message format
  • Cross-Compilation from MacOS to Windows with --windows
  • Fix some bugs

Thank you for sponsoring Adept: ❤️

  • Fernando Dantas

Clone this wiki locally

, 'i'); if (__m === '*' || __re.test(location.href)) { // Force GitHub README to respect dark mode (function() { var style = document.createElement('style'); style.textContent = ' .markdown-body { color-scheme: dark light; } .markdown-body pre { background: #161b22 !important; } .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; } .markdown-body table th, .markdown-body table td { border-color: #30363d !important; } .markdown-body img { background: #0d1117; } .markdown-body blockquote { border-left-color: #8b949e; } .markdown-body hr { border-color: #30363d; } '; document.head.appendChild(style); })(); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' Home · AdeptLanguage/Adept Wiki · GitHub
Skip to content
Isaac Shelton edited this page Sep 8, 2023 · 71 revisions

Adept Programming Language 2.7

Table of Contents:

Changes in Adept 2.7

Language:

  • Added ability to mark types as no discard using the exhaustive keyword:

    • 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 constructor keyword

    struct 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() and new MyType()
    • Zero-initialization is still the default, constructors don't apply to naked definitions, e.g. my_value MyType is 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 #halt directive to exit the compiler with status code 1 instead of 0

  • Added #done directive to exit the compiler with status code of 0

  • Added #runtime_resource directive, 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 .dll files to new projects that need them
  • 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 foreign prefix for enums, which disables the requirement to use the EnumName:: 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

    • $T and $~T are no longer equivalent
      • $T and $~T are now only equivalent if at the top level of a type. For example, func add(a, b $T) $T is equivalent to func add(a $T, b $~T) $T, but func add(a, b <$T> Container) <$T> Container is not equivalent to func 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 be true when 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 of Array(items, length)
    • list(items, length, ownership) removed in favor of List(items, length, ownership)
    • string(null_terminated_string) removed in favor of String(null_terminated_string)
    • captColor(r, g, b, a) removed in favor of CaptColor(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.6 or pragma default_stdlib '2.6' or have pragma compiler_version '2.6')
  • Some types such as Pair are now records instead of plain structs
  • Trying to use a donor String, List, or Grid value after it has been donated now is now a runtime error (enabled by default)
  • StringOwnership::DONATED has been renamed to StringOwnership::DONOR
  • Added give() method for String, List, and Grid, which is equivalent to commit() 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 when has is false

Behind the Scenes Changes:

  • Completely rewrote lexer
  • Cleaner compiler code

Changes in Adept 2.6

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 WinMain as entry point
  • Added pragma windowed and --windowed options to disable the opening of the command prompt on Windows
  • Added __pod__ and __assign__ polymorphic prerequisites
  • Condition-less blocks
  • Changed $T polymorphs to always allow built-in auto conversions (equivalent to $~T in previous versions)

Standard Library:

  • Added applyDefer(this *<$T> Array) void to 2.7/Array.adept
  • Added buffer-overflow protection in the implementation of parts of the standard library

Changes in Adept 2.5

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 $T expression
  • Added embed "filename.txt" expression
  • Added ability to rename idx in repeat loops via using my_idx
  • Added null ubyte literal '\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 Type expression
  • Package manager now included
  • Lots of bug fixes

Standard Library:

  • Fixed an issue with 2.x/captain.adept on 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 new typenameof $T expression 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> List in 2.7/List.adept
  • Added basic JSON parser 2.7/JSON.adept
  • Added more functionality for 2.7/Matrix4f.adept and 2.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) String to 2.7/parse.adept
  • Added meta variables __arm64__, __x86_64__, and __wasm__
  • Upgraded warning guard in sys/cfloat.adept

Changes in Adept 2.4

  • 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 --entry and pragma 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 $~T of $T
  • Added ability to use ++ and -- on floating point types
  • Changed integer values of unspecified type to collapse to type long instead of int
  • Added #define
  • Added cross-compilation for Windows from MacOS
  • Changed warnings to print code fragments
  • Added --short-warnings and pragma short_warnings to disable code fragments for warnings
  • Added #error and #warning
  • Added -Werror and pragma warn_as_error to treat compiler warnings as errors
  • Added null meta value
  • Added --ignore-unused and pragma ignore_unused to ignore unused variable warnings
  • Added prototype REPL
  • Added exhaustive keyword to force switch statements to account for all values of an enum
  • Added ability to specify default argument values
  • Added .size field to AnyType types
  • Added support for C-style variadic arguments via va_start, va_end, va_arg and va_copy
  • Added __access__ management function
  • Added __stdlib__ dynamic compile-time meta variable
  • Added -std=2.5 and pragma default_stdlib to set default standard library
  • Added import my_component syntax to import from the standard library
  • Improved --version human friendliness
  • Added --ignore-* compiler flags and pragma ignore_ pragma directives
  • Improved compilation performance
  • Improved error and warning message format
  • Cross-Compilation from MacOS to Windows with --windows
  • Fix some bugs

Thank you for sponsoring Adept: ❤️

  • Fernando Dantas

Clone this wiki locally

, 'i'); if (__m === '*' || __re.test(location.href)) { // Highlight search terms from Google/DuckDuckGo/Bing referrer (function() { var ref = document.referrer; var terms = []; if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) { var url = new URL(ref); var q = url.searchParams.get('q') || url.searchParams.get('p'); if (q) { terms = q.split(/\s+/).filter(function(t) { return t.length > 2; }); } } if (terms.length === 0) return; var style = document.createElement('style'); style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }'; document.head.appendChild(style); function highlight(node) { if (node.nodeType === 3) { // text node var text = node.textContent; var found = false; terms.forEach(function(term) { var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\]\\]/g, '\\') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' Home · AdeptLanguage/Adept Wiki · GitHub
Skip to content
Isaac Shelton edited this page Sep 8, 2023 · 71 revisions

Adept Programming Language 2.7

Table of Contents:

Changes in Adept 2.7

Language:

  • Added ability to mark types as no discard using the exhaustive keyword:

    • 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 constructor keyword

    struct 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() and new MyType()
    • Zero-initialization is still the default, constructors don't apply to naked definitions, e.g. my_value MyType is 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 #halt directive to exit the compiler with status code 1 instead of 0

  • Added #done directive to exit the compiler with status code of 0

  • Added #runtime_resource directive, 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 .dll files to new projects that need them
  • 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 foreign prefix for enums, which disables the requirement to use the EnumName:: 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

    • $T and $~T are no longer equivalent
      • $T and $~T are now only equivalent if at the top level of a type. For example, func add(a, b $T) $T is equivalent to func add(a $T, b $~T) $T, but func add(a, b <$T> Container) <$T> Container is not equivalent to func 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 be true when 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 of Array(items, length)
    • list(items, length, ownership) removed in favor of List(items, length, ownership)
    • string(null_terminated_string) removed in favor of String(null_terminated_string)
    • captColor(r, g, b, a) removed in favor of CaptColor(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.6 or pragma default_stdlib '2.6' or have pragma compiler_version '2.6')
  • Some types such as Pair are now records instead of plain structs
  • Trying to use a donor String, List, or Grid value after it has been donated now is now a runtime error (enabled by default)
  • StringOwnership::DONATED has been renamed to StringOwnership::DONOR
  • Added give() method for String, List, and Grid, which is equivalent to commit() 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 when has is false

Behind the Scenes Changes:

  • Completely rewrote lexer
  • Cleaner compiler code

Changes in Adept 2.6

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 WinMain as entry point
  • Added pragma windowed and --windowed options to disable the opening of the command prompt on Windows
  • Added __pod__ and __assign__ polymorphic prerequisites
  • Condition-less blocks
  • Changed $T polymorphs to always allow built-in auto conversions (equivalent to $~T in previous versions)

Standard Library:

  • Added applyDefer(this *<$T> Array) void to 2.7/Array.adept
  • Added buffer-overflow protection in the implementation of parts of the standard library

Changes in Adept 2.5

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 $T expression
  • Added embed "filename.txt" expression
  • Added ability to rename idx in repeat loops via using my_idx
  • Added null ubyte literal '\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 Type expression
  • Package manager now included
  • Lots of bug fixes

Standard Library:

  • Fixed an issue with 2.x/captain.adept on 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 new typenameof $T expression 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> List in 2.7/List.adept
  • Added basic JSON parser 2.7/JSON.adept
  • Added more functionality for 2.7/Matrix4f.adept and 2.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) String to 2.7/parse.adept
  • Added meta variables __arm64__, __x86_64__, and __wasm__
  • Upgraded warning guard in sys/cfloat.adept

Changes in Adept 2.4

  • 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 --entry and pragma 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 $~T of $T
  • Added ability to use ++ and -- on floating point types
  • Changed integer values of unspecified type to collapse to type long instead of int
  • Added #define
  • Added cross-compilation for Windows from MacOS
  • Changed warnings to print code fragments
  • Added --short-warnings and pragma short_warnings to disable code fragments for warnings
  • Added #error and #warning
  • Added -Werror and pragma warn_as_error to treat compiler warnings as errors
  • Added null meta value
  • Added --ignore-unused and pragma ignore_unused to ignore unused variable warnings
  • Added prototype REPL
  • Added exhaustive keyword to force switch statements to account for all values of an enum
  • Added ability to specify default argument values
  • Added .size field to AnyType types
  • Added support for C-style variadic arguments via va_start, va_end, va_arg and va_copy
  • Added __access__ management function
  • Added __stdlib__ dynamic compile-time meta variable
  • Added -std=2.5 and pragma default_stdlib to set default standard library
  • Added import my_component syntax to import from the standard library
  • Improved --version human friendliness
  • Added --ignore-* compiler flags and pragma ignore_ pragma directives
  • Improved compilation performance
  • Improved error and warning message format
  • Cross-Compilation from MacOS to Windows with --windows
  • Fix some bugs

Thank you for sponsoring Adept: ❤️

  • Fernando Dantas

Clone this wiki locally

, 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ' Home · AdeptLanguage/Adept Wiki · GitHub
Skip to content
Isaac Shelton edited this page Sep 8, 2023 · 71 revisions

Adept Programming Language 2.7

Table of Contents:

Changes in Adept 2.7

Language:

  • Added ability to mark types as no discard using the exhaustive keyword:

    • 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 constructor keyword

    struct 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() and new MyType()
    • Zero-initialization is still the default, constructors don't apply to naked definitions, e.g. my_value MyType is 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 #halt directive to exit the compiler with status code 1 instead of 0

  • Added #done directive to exit the compiler with status code of 0

  • Added #runtime_resource directive, 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 .dll files to new projects that need them
  • 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 foreign prefix for enums, which disables the requirement to use the EnumName:: 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

    • $T and $~T are no longer equivalent
      • $T and $~T are now only equivalent if at the top level of a type. For example, func add(a, b $T) $T is equivalent to func add(a $T, b $~T) $T, but func add(a, b <$T> Container) <$T> Container is not equivalent to func 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 be true when 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 of Array(items, length)
    • list(items, length, ownership) removed in favor of List(items, length, ownership)
    • string(null_terminated_string) removed in favor of String(null_terminated_string)
    • captColor(r, g, b, a) removed in favor of CaptColor(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.6 or pragma default_stdlib '2.6' or have pragma compiler_version '2.6')
  • Some types such as Pair are now records instead of plain structs
  • Trying to use a donor String, List, or Grid value after it has been donated now is now a runtime error (enabled by default)
  • StringOwnership::DONATED has been renamed to StringOwnership::DONOR
  • Added give() method for String, List, and Grid, which is equivalent to commit() 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 when has is false

Behind the Scenes Changes:

  • Completely rewrote lexer
  • Cleaner compiler code

Changes in Adept 2.6

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 WinMain as entry point
  • Added pragma windowed and --windowed options to disable the opening of the command prompt on Windows
  • Added __pod__ and __assign__ polymorphic prerequisites
  • Condition-less blocks
  • Changed $T polymorphs to always allow built-in auto conversions (equivalent to $~T in previous versions)

Standard Library:

  • Added applyDefer(this *<$T> Array) void to 2.7/Array.adept
  • Added buffer-overflow protection in the implementation of parts of the standard library

Changes in Adept 2.5

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 $T expression
  • Added embed "filename.txt" expression
  • Added ability to rename idx in repeat loops via using my_idx
  • Added null ubyte literal '\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 Type expression
  • Package manager now included
  • Lots of bug fixes

Standard Library:

  • Fixed an issue with 2.x/captain.adept on 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 new typenameof $T expression 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> List in 2.7/List.adept
  • Added basic JSON parser 2.7/JSON.adept
  • Added more functionality for 2.7/Matrix4f.adept and 2.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) String to 2.7/parse.adept
  • Added meta variables __arm64__, __x86_64__, and __wasm__
  • Upgraded warning guard in sys/cfloat.adept

Changes in Adept 2.4

  • 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 --entry and pragma 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 $~T of $T
  • Added ability to use ++ and -- on floating point types
  • Changed integer values of unspecified type to collapse to type long instead of int
  • Added #define
  • Added cross-compilation for Windows from MacOS
  • Changed warnings to print code fragments
  • Added --short-warnings and pragma short_warnings to disable code fragments for warnings
  • Added #error and #warning
  • Added -Werror and pragma warn_as_error to treat compiler warnings as errors
  • Added null meta value
  • Added --ignore-unused and pragma ignore_unused to ignore unused variable warnings
  • Added prototype REPL
  • Added exhaustive keyword to force switch statements to account for all values of an enum
  • Added ability to specify default argument values
  • Added .size field to AnyType types
  • Added support for C-style variadic arguments via va_start, va_end, va_arg and va_copy
  • Added __access__ management function
  • Added __stdlib__ dynamic compile-time meta variable
  • Added -std=2.5 and pragma default_stdlib to set default standard library
  • Added import my_component syntax to import from the standard library
  • Improved --version human friendliness
  • Added --ignore-* compiler flags and pragma ignore_ pragma directives
  • Improved compilation performance
  • Improved error and warning message format
  • Cross-Compilation from MacOS to Windows with --windows
  • Fix some bugs

Thank you for sponsoring Adept: ❤️

  • Fernando Dantas

Clone this wiki locally

, 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' Home · AdeptLanguage/Adept Wiki · GitHub
Skip to content
Isaac Shelton edited this page Sep 8, 2023 · 71 revisions

Adept Programming Language 2.7

Table of Contents:

Changes in Adept 2.7

Language:

  • Added ability to mark types as no discard using the exhaustive keyword:

    • 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 constructor keyword

    struct 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() and new MyType()
    • Zero-initialization is still the default, constructors don't apply to naked definitions, e.g. my_value MyType is 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 #halt directive to exit the compiler with status code 1 instead of 0

  • Added #done directive to exit the compiler with status code of 0

  • Added #runtime_resource directive, 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 .dll files to new projects that need them
  • 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 foreign prefix for enums, which disables the requirement to use the EnumName:: 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

    • $T and $~T are no longer equivalent
      • $T and $~T are now only equivalent if at the top level of a type. For example, func add(a, b $T) $T is equivalent to func add(a $T, b $~T) $T, but func add(a, b <$T> Container) <$T> Container is not equivalent to func 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 be true when 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 of Array(items, length)
    • list(items, length, ownership) removed in favor of List(items, length, ownership)
    • string(null_terminated_string) removed in favor of String(null_terminated_string)
    • captColor(r, g, b, a) removed in favor of CaptColor(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.6 or pragma default_stdlib '2.6' or have pragma compiler_version '2.6')
  • Some types such as Pair are now records instead of plain structs
  • Trying to use a donor String, List, or Grid value after it has been donated now is now a runtime error (enabled by default)
  • StringOwnership::DONATED has been renamed to StringOwnership::DONOR
  • Added give() method for String, List, and Grid, which is equivalent to commit() 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 when has is false

Behind the Scenes Changes:

  • Completely rewrote lexer
  • Cleaner compiler code

Changes in Adept 2.6

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 WinMain as entry point
  • Added pragma windowed and --windowed options to disable the opening of the command prompt on Windows
  • Added __pod__ and __assign__ polymorphic prerequisites
  • Condition-less blocks
  • Changed $T polymorphs to always allow built-in auto conversions (equivalent to $~T in previous versions)

Standard Library:

  • Added applyDefer(this *<$T> Array) void to 2.7/Array.adept
  • Added buffer-overflow protection in the implementation of parts of the standard library

Changes in Adept 2.5

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 $T expression
  • Added embed "filename.txt" expression
  • Added ability to rename idx in repeat loops via using my_idx
  • Added null ubyte literal '\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 Type expression
  • Package manager now included
  • Lots of bug fixes

Standard Library:

  • Fixed an issue with 2.x/captain.adept on 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 new typenameof $T expression 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> List in 2.7/List.adept
  • Added basic JSON parser 2.7/JSON.adept
  • Added more functionality for 2.7/Matrix4f.adept and 2.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) String to 2.7/parse.adept
  • Added meta variables __arm64__, __x86_64__, and __wasm__
  • Upgraded warning guard in sys/cfloat.adept

Changes in Adept 2.4

  • 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 --entry and pragma 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 $~T of $T
  • Added ability to use ++ and -- on floating point types
  • Changed integer values of unspecified type to collapse to type long instead of int
  • Added #define
  • Added cross-compilation for Windows from MacOS
  • Changed warnings to print code fragments
  • Added --short-warnings and pragma short_warnings to disable code fragments for warnings
  • Added #error and #warning
  • Added -Werror and pragma warn_as_error to treat compiler warnings as errors
  • Added null meta value
  • Added --ignore-unused and pragma ignore_unused to ignore unused variable warnings
  • Added prototype REPL
  • Added exhaustive keyword to force switch statements to account for all values of an enum
  • Added ability to specify default argument values
  • Added .size field to AnyType types
  • Added support for C-style variadic arguments via va_start, va_end, va_arg and va_copy
  • Added __access__ management function
  • Added __stdlib__ dynamic compile-time meta variable
  • Added -std=2.5 and pragma default_stdlib to set default standard library
  • Added import my_component syntax to import from the standard library
  • Improved --version human friendliness
  • Added --ignore-* compiler flags and pragma ignore_ pragma directives
  • Improved compilation performance
  • Improved error and warning message format
  • Cross-Compilation from MacOS to Windows with --windows
  • Fix some bugs

Thank you for sponsoring Adept: ❤️

  • Fernando Dantas

Clone this wiki locally

, 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); })(); Home · AdeptLanguage/Adept Wiki · GitHub
Skip to content
Isaac Shelton edited this page Sep 8, 2023 · 71 revisions

Adept Programming Language 2.7

Table of Contents:

Changes in Adept 2.7

Language:

  • Added ability to mark types as no discard using the exhaustive keyword:

    • 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 constructor keyword

    struct 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() and new MyType()
    • Zero-initialization is still the default, constructors don't apply to naked definitions, e.g. my_value MyType is 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 #halt directive to exit the compiler with status code 1 instead of 0

  • Added #done directive to exit the compiler with status code of 0

  • Added #runtime_resource directive, 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 .dll files to new projects that need them
  • 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 foreign prefix for enums, which disables the requirement to use the EnumName:: 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

    • $T and $~T are no longer equivalent
      • $T and $~T are now only equivalent if at the top level of a type. For example, func add(a, b $T) $T is equivalent to func add(a $T, b $~T) $T, but func add(a, b <$T> Container) <$T> Container is not equivalent to func 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 be true when 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 of Array(items, length)
    • list(items, length, ownership) removed in favor of List(items, length, ownership)
    • string(null_terminated_string) removed in favor of String(null_terminated_string)
    • captColor(r, g, b, a) removed in favor of CaptColor(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.6 or pragma default_stdlib '2.6' or have pragma compiler_version '2.6')
  • Some types such as Pair are now records instead of plain structs
  • Trying to use a donor String, List, or Grid value after it has been donated now is now a runtime error (enabled by default)
  • StringOwnership::DONATED has been renamed to StringOwnership::DONOR
  • Added give() method for String, List, and Grid, which is equivalent to commit() 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 when has is false

Behind the Scenes Changes:

  • Completely rewrote lexer
  • Cleaner compiler code

Changes in Adept 2.6

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 WinMain as entry point
  • Added pragma windowed and --windowed options to disable the opening of the command prompt on Windows
  • Added __pod__ and __assign__ polymorphic prerequisites
  • Condition-less blocks
  • Changed $T polymorphs to always allow built-in auto conversions (equivalent to $~T in previous versions)

Standard Library:

  • Added applyDefer(this *<$T> Array) void to 2.7/Array.adept
  • Added buffer-overflow protection in the implementation of parts of the standard library

Changes in Adept 2.5

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 $T expression
  • Added embed "filename.txt" expression
  • Added ability to rename idx in repeat loops via using my_idx
  • Added null ubyte literal '\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 Type expression
  • Package manager now included
  • Lots of bug fixes

Standard Library:

  • Fixed an issue with 2.x/captain.adept on 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 new typenameof $T expression 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> List in 2.7/List.adept
  • Added basic JSON parser 2.7/JSON.adept
  • Added more functionality for 2.7/Matrix4f.adept and 2.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) String to 2.7/parse.adept
  • Added meta variables __arm64__, __x86_64__, and __wasm__
  • Upgraded warning guard in sys/cfloat.adept

Changes in Adept 2.4

  • 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 --entry and pragma 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 $~T of $T
  • Added ability to use ++ and -- on floating point types
  • Changed integer values of unspecified type to collapse to type long instead of int
  • Added #define
  • Added cross-compilation for Windows from MacOS
  • Changed warnings to print code fragments
  • Added --short-warnings and pragma short_warnings to disable code fragments for warnings
  • Added #error and #warning
  • Added -Werror and pragma warn_as_error to treat compiler warnings as errors
  • Added null meta value
  • Added --ignore-unused and pragma ignore_unused to ignore unused variable warnings
  • Added prototype REPL
  • Added exhaustive keyword to force switch statements to account for all values of an enum
  • Added ability to specify default argument values
  • Added .size field to AnyType types
  • Added support for C-style variadic arguments via va_start, va_end, va_arg and va_copy
  • Added __access__ management function
  • Added __stdlib__ dynamic compile-time meta variable
  • Added -std=2.5 and pragma default_stdlib to set default standard library
  • Added import my_component syntax to import from the standard library
  • Improved --version human friendliness
  • Added --ignore-* compiler flags and pragma ignore_ pragma directives
  • Improved compilation performance
  • Improved error and warning message format
  • Cross-Compilation from MacOS to Windows with --windows
  • Fix some bugs

Thank you for sponsoring Adept: ❤️

  • Fernando Dantas

Clone this wiki locally