1. Allow specifying an optimal postcondition at the end of the if and while statements
Before (in NiLang):
if (precondition, postcondition)
statememts...
else
statements...
end
while (precondition, postcondition)
statememts...
end
After:
if precondition
statememts...
else
statements...
end [postcondition]
while precondition
statememts...
end [postcondition]
2. Add a new control flow for compute-copy-uncompute
Before (in NiLang):
@routine begin
statements1...
end
statements2...
~@routine
After:
compute
statements1...
copy
statements2...
end
I find it particularly useful in reversible programming. Which first compute something (statement1s), then copy the result to a new space (statement2s), and finally undo the computing process (~statement1s).
1 is a non-breaking feature, so I wish it can be accepted in the near future. While for 2, we need more discussion.
Changes that make reversible programming happier
1. Allow specifying an optimal postcondition at the end of the
if
andwhile
statementsBefore (in NiLang):
After:
2. Add a new control flow for compute-copy-uncompute
Before (in NiLang):
After:
I find it particularly useful in reversible programming. Which first compute something (statement1s), then copy the result to a new space (statement2s), and finally undo the computing process (~statement1s).
1 is a non-breaking feature, so I wish it can be accepted in the near future. While for 2, we need more discussion.
Reference
https://github.com/GiggleLiu/NiLang.jl