ELENA is a general-purpose language with late binding. It is multi-paradigm, combining features of functional and object-oriented programming. Rich set of tools are provided to deal with message dispatching : multi-methods, message qualifying, generic message handlers, run-time interfaces
Is your feature request related to a problem? Please describe.
Compiler should warn if the operation with nil is possible. Nil-safe code should be used instead. Only implicitly nullable types
should allow operation where the target can be nil
Describe the solution you'd like
The type declaration should have a special attribute ?
import extensions;
singleton Tester
{
test(int? prm)
{
^ prm.hasValue ? (prm.Value) : 0
}
}
public program()
{
var t := Tester;
console.printLine("Tester.test(2)=",Tester.test(2));
console.printLine("t.test(3)=",t.test(3));
console.printLine("Tester.test(nil)=",Tester.test(nil));
console.printLine("t.test(nil)=",t.test(nil));
}
The nullable structures are special case - they are in fact a reference type
Open issues:
boxing to Nullable?
support nullable reference (when option is on, warning on unsafe operation)
nullable : int? == int? -> return bool?
nullable : int? + int? -> return int? (if both nil -> the result is nil)
Is your feature request related to a problem? Please describe. Compiler should warn if the operation with nil is possible. Nil-safe code should be used instead. Only implicitly nullable types should allow operation where the target can be nil
Describe the solution you'd like The type declaration should have a special attribute ?
The nullable structures are special case - they are in fact a reference type
Open issues: