Tlön is a programming language transpiled into Modern C++. These are the key goals:
- Add features which C++ is missing.
- Throw out all the legacy crap that's been dragged into C++ over the years.
- Also, just simplify things.
- Provide a sensible API over Standard Library/STL.
- Other lofty goals :)
For a more lively demonstration, watch this video.
The following is an approximate featureset with explanations why those features are in there.
- Two-step front-end implementation
- Make use of non-keyboard symbols (e.g., subscript/superscript).
- Later: a flexible editor.
- No semicolons (they can be used for something else).
- No inappropriate symbols:
-
is not subtraction,*
is not multiplication, etc. This prevents the subversion of well-defined mathematical symbols. - Bitwise operators strictly textual (
xor
), no operator symbols. Avoids the confusion between&&
and&
etc. %
means%
, i.e.5%
means0.05
. Operatorsmod
andrem
used instead.- Minute/second marks
"'
cannot be used for string or characters. <
or>
cannot be used for anything other than less-that/greater-than.
- Definitions via
:=
for non-constant and≝
(or≡
) for constants. (WIP) =
used as comparison operator, also valid in mutual comparisonsif (a = b = c)
- Assignment via
->
and<-
(both ways). This helps readability in some cases. - Assignment can cluster (
x,y <- 0
,x -> y,z
) and daisy-chain (x -> y -> z
) - JAI's
delay
for executing code at the end of scope.
- Extended symbol range allows identifiers with printable non-numeric, non-syntax letters.
- Access modifier prefix?
-private, #protected, +public
. - Forced initial values (zeros for numerics,
0
for bits). Principle of least surprise.
- Namespace declarations do not 'cause' a scope, content not wrapped in
{}
. This avoids a 1-tab indentation of everything you write and in 99% is a meaningless idea. - Multipart declarations are permitted:
namespace Foo.Bar
. Avoids insanity likenamespace Foo { namespace Bar { ...
. - Fused namespace-and-class declaration. Writing
class Foo.Bar
creates namespaceFoo
and treats all subsequence input as pertaining to classBar
, unless... - Fused namespace-and-inner-class declaration. If you must. Writing
class Foo.Bar.Baz
where a classBar
already exists in namespaceFoo
does, you guessed it, an inner classBaz
that's declared insideBar
.
- All types inherit from
tlön::object
whose interface containsequals()
,hash_code()
andstr()
(just like C#). - Interfaces (a la C#/Java).
- Can feature property definitions (like C#).
- Virtual destructor added by default.
- Virtual dispatch-centric (visitor) member?
- Global members not allowed
- All types support reflection by including a
static
table of reflection-based info. - Reflection is intended to work as it does in C#, i.e., an ability to inspect a type's properties & methods.
- Reflection is intended to provide
invoke()
functionality.
add := (a,b:i32 := 0) => a+b
-- argument clustering, default value, noreturn
statement and return type inferencing.- Capture modes indicated by subscript? E.g.,
add_five := x => twoᵥ + threeᵣ
. - Things are passed and stored by reference by default;
- The concept of a 'field' does not exist in Tlön. Period.
- Expandable from an existing field declaration, e.g.
x,y := 0
becomesx,y := 0 with get := xx and set := it -> xx
. - Auto-properties
x := 0 with get and set
. - Bindable properties, e.g.,
x =:= y
ensuresx
is always set toy
via an atomic change. Implies construction of critical sections.
- TODO; most likely based on
boost::signal<>
These are some features that will be baked into the system:
- Database system: most likely a direct-to-metal interface for some commercial database system (e.g., MongoDB). Think Slang/SecDB.
- Dependency injection: given that we have reflection, DI is going to be baked in and used everywhere.