Skip to content

remaining usecases for macros (when reusable functions, and in-lined globals exist) #414

Description

@mr-zwets

remaining usecases for macros (when reusable functions, and in-lined global constants exist)

  1. Re-usable functions with OP_DEFINE/OP_INVOKE change the context for checksig and this.activeBytecode so a function block using this could be a macro and still re-used across contract spending functions without changing context

  2. replaces the need for "syntactic suger for the activeInput and to potentially do something similar for the corresponding output"
    consider sytactic suger for the activeInput #234

because this does not work with resuable functions, because Input or Output is not a real type, introspection opcodes immediate operate on the field, so really only this.activeInputIndex is a real item in script tx.inputs[] itself is an incomplete statement

function getActiveInput() returns (Input) {
   return tx.inputs[this.activeInputIndex]
}

so macros I assume would just be naive string replacement

Metadata

Metadata

Assignees

No one assigned

    Labels

    cashc-compilerRelates to the cashc compiler

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions