Can anyone give an example of a verse function that <transacts>
, or in other words undo its actions. Like how would this undoing of actions look like. I dont get it. When and how would you ever undo something after you just called the function.
Wait I think I get it. if I have a function
Function()<transacts>:void={
set someMemberVar = 10
}
and call
Function2(Xs:array)<decides>:[]int={
Looop := for:
X:Xs
Function()
1=2 #false, undo the set to 10 from Function()
}
do:
1
It undoes the reasignment for someMemberVar.
Am I right or nah?
Also what would an undo of this function look like
Function3()<transacts>:int={
return 1
}
like how do you undo a return
I’d love some better documentation about the fundamentals of the Verse language and syntax.
I’m currently fighting a ‘no_rollback’ issue and there’s very little documentation about ‘decides’ (that I can find).
These pages are utterly useless to me at this point in my learning-curve:
Also (and apologies for wandering slightly off-subject): Is there a way to limit search to only UEFN topics? Nearly every search I do returns thousands of UE answers which don’t apply.
I don’t know if this answers your question… after reading this (again!) I managed to muddle through a solution to my problem by using both "<decides>" and "<transacts>"
specifiers on the function.
transacts: This effect indicates that any actions performed by the function can be rolled back. The transacts effect is required any time a mutable variable (var
) is written. You’ll be notified when you compile your code if the transacts
effect was added to a function that can’t be rolled back. Note that this check is not done for functions with the native
specifier.
There’s a ton of stuff in this page and it’s often hard to take it in on the first (or fifth) read-through!