The irony is the moment I finished this feature I realized it is not enough — I need also a tracking system which would allow to postpone initialization.
But at least when you need to do some precomputation and then initialize variables you can use entire block as initialization value:
let (yyyy,mm,dd) = * do let parts = s.split("-"); // the outcome of the entire do-end block parts ++ "".copy((3-parts.count())); end
It is better than nothing but I would prefer to write:
let yyyy,mm,dd Int; // postponed initialization do let parts = s.split("-"); // initialization (yyyy,mm,dd) = *(parts ++ "".copy((3-parts.count()))); end
In both cases temporary variable
parts does not leak, but I am more used to the latter form. On the other hand only the former will work with loops, unlike in Scala which returns just
void in Skila) I am going to add some muscles to them.