The Adept Programming Language
Adept 2.7 has been released!
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
}
__constructor__
method, which can be used to call a constructor on any valuemy_value MyType()
and new MyType()
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)
.dll
files to new projects that need themAdded 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
}
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())
}
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:
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)
--std=2.6
or pragma default_stdlib '2.6'
or have pragma compiler_version '2.6'
)Pair
are now records instead of plain structsString
, 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
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.__assign__
for Optional, so that their internal values are not improperly assigned when has
is falseBehind the Scenes Changes:
Adept 2.7 is also backwards compatible with most programs written in versions 2.0 through 2.6
Last built on May 25 2024 at 8:06 PM UTC - c16268bf457e69f6b43882cf650682685d0d43a8
Adept 2.6 has been released!
Language:
record Person (firstname, lastname String)
[]
fixed array syntaxfixed_array [count] int
__defer__
functions are no longer generated, while also maintaining backwards compatibility__assign__
functions when applicableWinMain
as entry pointpragma windowed
and --windowed
options to disable the opening of the command prompt on Windows__pod__
and __assign__
polymorphic prerequisites$T
polymorphs to always allow built-in auto conversions (equivalent to $~T
in previous versions)Standard Library:
applyDefer(this *<$T> Array) void
to 2.6/Array.adept
Behind the Scenes Changes:
Adept 2.6 also supports backwards-compatibility with most programs written in Adept 2.0 through Adept 2.5.
Preview Features:
record Person (firstname, lastname String)
[]
fixed array syntaxfixed_array [count] int
__defer__
functions are no longer generated, while also maintaining backwards compatibility__assign__
functions when applicableWinMain
as entry pointpragma windowed
and --windowed
options to disable the opening of the command prompt on Windows__pod__
and __assign__
polymorphic prerequisites$T
polymorphs to always allow built-in auto conversions (equivalent to $~T
in previous versions)Quality of Life:
Thank you for sponsoring Adept: ❤️
Preview Build of Adept 2.6 compiled on Dec-2-2021
Platform: Windows
Adept Build: Adept 2.6 - Build Dec 2 2021 18:49:44 CDT
Adept Version: 2.6
Pkg Manager: enabled
Import Folder: "C:\Adept\2.6-Preview-Build-Dec-2-2021\import\"
Stblib Folder: "C:\Adept\2.6-Preview-Build-Dec-2-2021\import\2.6"
Preview Features:
record Person (firstname, lastname String)
[]
fixed array syntaxfixed_array [count] int
__defer__
functions are no longer generated, while also maintaining backwards compatibility__assign__
functions when applicableWinMain
as entry pointpragma windowed
and --windowed
options to disable the opening of the command prompt on Windows__pod__
and __assign__
polymorphic prerequisitesThank you for sponsoring Adept: ❤️
Adept 2.5 has been released
Freshly updated documentation is available at https://github.com/AdeptLanguage/Adept/wiki
Language:
using namespace
typenameof $T
expressionembed "filename.txt"
expressionidx
in repeat
loops via using my_idx
ubyte
literal '\0'ub
thing1().thing2().thing3()
__compiler_major__
, __compiler_minor__
, __compiler_release__
, and __compiler_version_name__
__compiler_version__
to be a number instead of a string (__compiler_version_name__
now exists for string version)alignof Type
expressionStandard Library:
2.x/captain.adept
on HDPI displays. Solution was back-ported to earlier versions2.4/aabb.adept
2.5/cmath.adept
2.5/*
to use new typenameof $T
expression instead of RTTI when possibleunix/sys/time.adept
2.5/captain.adept
clone(this *<*$P> List) <*$P> List
in 2.5/List.adept
2.5/JSON.adept
2.5/Matrix4f.adept
and 2.5/Vector3f.adept
2.x/Optional.adept
stb/image.adept
2.5/Unique.adept
2.5/Grid.adept
2.5/captain.adept
join(this *<String> List) String
to 2.5/parse.adept
__arm64__
, __x86_64__
, and __wasm__
sys/cfloat.adept
Adept 2.5 also supports backwards-compatibility with most programs written in Adept 2.0 through Adept 2.4.
Preview Build of Adept 2.5 for Windows
Built on Oct-18-2021 with package manager disabled
Platform: Windows
Adept Build: Adept 2.5 - Build Oct 18 2021 11:41:04 CDT
Adept Version: 2.5
Pkg Manager: disabled
Import Folder: "C:\Adept\2.5-Preview-Build-Oct-18-2021\import\"
Stblib Folder: "C:\Adept\2.5-Preview-Build-Oct-18-2021\import\2.5"
Adept 2.4 has been released!
Now with better in-depth documentation! Available at https://github.com/AdeptLanguage/Adept/wiki
__as__
management function~>
operator$#N
--entry
and pragma entry_point
sizeof(value)
expressionprintf(String, args ...)
$~T
of $T
++
and --
on floating point typeslong
instead of int
#define
--short-warnings
and pragma short_warnings
to disable code fragments for warnings#error
and #warning
-Werror
and pragma warn_as_error
to treat compiler warnings as errorsnull
meta value--ignore-unused
and pragma ignore_unused
to ignore unused variable warningsexhaustive
keyword to force switch statements to account for all values of an enum.size
field to AnyType
typesva_start
, va_end
, va_arg
and va_copy
__access__
management function__stdlib__
dynamic compile-time meta variable-std=2.4
and pragma default_stdlib
to set default standard libraryimport my_component
syntax to import from the standard library--version
human friendliness--ignore-*
compiler flags and pragma ignore_
pragma directives--windows
Adept 2.4 also supports backwards-compatibility with most programs written in Adept 2.0 through Adept 2.3.
A new version of Adept has been released!
Major Features:
__defer__
function auto-generation__pass__
function auto-generationverbatim
keyword to disable auto-generation inside special functions!!
operator--null-checks
/ pragma null_checks
fallthrough
keywordrepeat static
and each-in static
loopsoffsets
in AnyStructType
Adept 2.3 also supports backwards-compatibility with most programs written in Adept 2.0 through Adept 2.2.