|
|
|
|
|
by AlexanderDhoore
4384 days ago
|
|
The length of all lists is known at compile-time. So, yes, you can do "sum range hugeNumber", but the compiler will tell you that your program can't be run at the correct frequency. (The possible range of the `hugeNumber` variable is known to the compiler, so it can know the maximum size of the list you are asking.) The compiler can find out the range of numbers and the lengths of lists using static analysis, because SolScript is such a "restricted" language. Functional programmers would probably dump all that information into a type system. We call it "dataflow analysis", but I think the end result is the same. Note that, all of the static analysis is done on the dataflow graph underlying a SolScript program. In the dataflow graph there are no "functions" or "classes"... The static analysis is much simpler because it is done on something more primitive than the language itself. |
|