Blade JIT allows us to re-assess a few things about Blade and introduce greater flexibility and security to the language and runtime in general.
constkeyword for declaring constants.- Everything except
nilis now an object — even numbers and boolean. - A new way for type validation: Formerly, to verify if a value is of a type, we use one of the
is_*functions. For example, we have the built-in functionis_string. This gave rise to too many built-in functions using up words that would have made good variable names and therefore easy to overwrite. With the new update to the language, we can dostring.get_class() == String. Sinceget_class()is a method available of all objects, this is less easy to overwrite and thereby leads to a more secure code. - Reinstated
try..catch..finally..exception handling construct as thecatch..as..introduced an insecure overhead to emulating thefinally..behavior which itself is a great requirement for secure code. - Variadic function and methods arguments must be assigned a name at the point of declaration and the automatically
declared variable
__args__is no longer declared. E.g.def my_function(...my_arg). This allows for more flexibility and intentionality in variadic function handling. - All objects now automatically declare the
to_string()instance method and all classes have an automaticto_string()function if they fail to declare an override. For this reason, theto_string()built-in function is no longer available. - String and List no longer have a
.length()method but rather have a.lengthproperty. This property carries a restriction that they cannot be overwritten. - Dictionary no longer exposes the
.length()method. Instead, the.size()method has replaced it. - All builtin methods can now also be accessed via their class. This removes ambiguity between methods and functions
when overwritten by a program. For example, before, should a dictionary contain an object
length, it automatically becomes impossible for us to get the length of that dictionary as.length()will return the new declaration. By allowing calling object methods directly from their class, one can still get the length of the dictionary by via the class by callingDictionary.size(my_dict).