require
functionrequire(elem : truth)
, panics when falseassert
function that can be turned on or off?stop
, skip
and yield
improvementsUNIVERSAL_SUBTYPE
, so that they can be used anywherepanic
should be allowed anywherepanic
yield the type UNIVERSAL_SUBTYPE
.panic
functions should check for it everywhere inside expressions.int[from 0 to 99]
b_and
b_or
b_xor
b_left
b_right
b_comp
collection[key] := value
- equivalent to add
collection[key]
- equivalent to get
otherwiseInfinity
and MinusInfinity
as singleton typesIt would allow things like either[int,Infinity]
Generics need to be reworked, they are too complex and the code is very unclear and potentially buggy. Breaking backwards compatibility is probably going to have to be done.
This is a broad issue that will require some thinking.
Instead of the current specifications file, there should be in detail explanations for each of the statement types.
Syntax:
write_line("2 + 3 = $2 + 3;")
"accepted" or "rejected"
No description provided.
anything
+ fix testsNo description provided.
No description provided.
Get a character out of a number.
No description provided.
No description provided.
@
operatorThe @
operator should be removed, for the following reasons:
get
function exists, and as such it is mostly redundant.list[type?]
, it cannot differentiate between an element not existing and an element being nothing
.nothing
, but by a real exception handling system.@
after all, it should exist as syntactic sugar only.The main difficulty would occur with adapting all the tests.
{key -> value, key -> value} : type -> type
either
typeseither[type1, type2]
, also allow type1 or type2
.The following code breaks the type checking, as it is allowed to run despite failing at run time:
let func := fun(arg list : list[int])
begin
let object : anything := list
when object is mut[list[text]]
begin
object.add(at := 0, "hi!")
yield nothing
end
panic("oops!")
end
let list := mut [] : int
func(list)
let a := list.get(0)
writeline(a > 0)
Instead of just stating that the function cannot be called with the provided arguments, a reason should be provided for why that is the case (such as unmatching types, too many arguments, not enough arguments etc)
=
to all typesInternally this functionality already exists due to dict
s, so it should be expanded to language users as well. Equalities that are impossible at runtime (e.g. int to string) should not be allowed.
Example of falling test:
let a := [1,2,3]
let b := [1,2,3]
writeline(a=b)
dict
s moreNo description provided.
dict.keys
Add function keys
that will return a dictionary’s list of keys. Will make it possible to iterate over a dictionary.
ObjectDetails.getType()
should return the type based on the elements of the dictionary if the dict is mutable, similar to how it works for lists.
Example:
let list := [1,2,3]
writeline(list.add(at := "hi", 4))
Error message displayed:
>>> COMPILATION FAILED
>>>
>>> Line 2: The function cannot be called with these arguments. Reason: The type definition TYPE MUTABLE; (TYPE COLLECTION; (TYPE GENERIC; (!T|add_key; TYPE EITHER; (TYPE ANYTHING; TYPE !nothing); DECLARE); TYPE GENERIC; (!T|add_value; TYPE EITHER; (TYPE ANYTHING; TYPE !nothing); DECLARE))) conflicts with the inferred type TYPE LIST; (TYPE INT64) for identifier "collection".
>>> writeline(list.add(at := "hi", 4))
>>> ^
>>>
This is not very helpful.
dict.as_text
not in the proper formatlet b := {1 -> 5, 2 -> 6} : int -> int
writeline(b)
expected:
{1 -> 5, 2 -> 6}
actual:
{1=5, 2=6}
dict
doesn’t have type inferred properlyE.g.:
let b := {} : int -> int
writeline(b.type)
int
types should maybe be BigInteger, not Long?This is an option to consider. The language will be more user-friendly, at the cost of performance.
let f := fun(x : int) do nothing
when f is fun[x : int] begin
f(x := 10)
end
let f := do nothing
when f is fun[] begin
writeline("hi")
end
It works fine like this:
let f := do nothing
when f is fun[->nothing] begin
writeline("hi")
end
Example
typedef person := data[name : text, age : int]
data
is the keyword here. Subtype of dict
.
With closures, things like “private fields” should be possible to implement.
No description provided.
writeline
should be write_line
For better consistency with read_line
set
function for everythingWhy?
mut
shouldn’t be used for regular values, instead var
is preferredeither
in favor of or
?Remove support for either
in favor of or
?
rational
into an exact base 10 rational typeNo description provided.
import
operator: make variables from the outside scope accessible by defaultNo description provided.
+
Too prone to abuse.
\
for string literals and commentsNo description provided.
No description provided.
New string escaping mechanism with the format \code;
, to replace the HTML-based string escaping.
No description provided.
No description provided.
No description provided.
write(1.0 / 6)
No description provided.
No description provided.