algorand / algorand/go-algorand
Conditional subroutine opcodes
- 主要言語
- Go
- スター
- 1.4k
- フォーク
- 537
- 平均マージ
- 1日 7時間
- マージ済み PR(30日)
- 18
説明
## Status
Currently, some redundant teal code must be written to achieve a conditional callsub. and in some cases like inside subroutines, it seems even more unhandy and troublesome!
## Expected
Simpler one-liner conditional calls on subroutines
## Solution
2 New opcodes are proposed :
- "callsubz": calls a subroutine is the last stack value is 0 and continues forward with returned value (continues if not zero)
- "callsubnz": calls a subroutine is the last stack value is NOT 0 and continues forward with returned value (continues if not zero)
Both normal callsub but conditional (same structure as callsub with retsub)
Both would normally continue if the condition is not met.
Both work identically like "bz" and "bnz" with one difference and that is they add a value to stack as they continue to follow code after return (with their retsubs as normal callsub does).
## Dependencies
Normally this is neither a big nor a breaking change because the functionality and pointer ops are already there and these two opcodes are just a new composition on same existing operations there .
## Urgency
This is an old pain point and it has been brought up on Discord conversations but it is better to be an issue here and open for discussion IMHO!
It simplifies development and has an impact on what's possible to build also it is showing to be a real pain and given the feature being rather simple, urgency would be much appreciated.
コントリビューションガイド
評価
この issue はまだ評価されていません。