effect.go 874 B

12345678910111213141516171819202122232425262728293031
  1. package attl
  2. // Flow deterimes how the flow of execution is
  3. // affected by a command
  4. type Flow int
  5. // No effect
  6. const NormalFlow Flow = 0
  7. // Breaks out of the current block
  8. const BreakFlow Flow = 1
  9. // Breaks out of the current command
  10. const ReturnFlow Flow = 2
  11. // Error, breaks until rescue block is ofound
  12. const FailFlow Flow = 4
  13. // Every attl command evaluates to a value, which is the result
  14. // of the command itself, but also an Effect that describes
  15. // it's special effect on the flow of evaluation itself.
  16. // A nil effect simply means "continue to the next command"
  17. // But other effects may cause the flow of execution to change
  18. // as per the Flow member
  19. // The unwrap member returns the Value that
  20. // the effect was carrying wrapped in it
  21. // and which is unwrapped when the effect has influenced the flow.
  22. type Effect interface {
  23. Flow() Flow
  24. Unwrap() Value
  25. }