DefaultMacro is the instance all non-lexical macros in the system are derived from.

Mimics
Inactive cells
Active cells
Specs
Inactive cells (details)
activatable = true
kind = "DefaultMacro"
Active cells (details)
argumentsCode()

returns the code for the argument definition

DefaultMacro argumentsCode
  • - should validate type of receiver [ show source ]
    cell("DefaultMacro") should checkReceiverTypeOn(:argumentsCode) 
    
    
arity()

nil

method(
  Arity fromArgumentsCode(argumentsCode))
call(+[arguments])

activates this macro with the arguments given to call

code()

returns the full code of this macro, as a Text

DefaultMacro code
  • - should validate type of receiver [ show source ]
    cell("DefaultMacro") should checkReceiverTypeOn(:code) 
    
    
formattedCode()

returns idiomatically formatted code for this macro

DefaultMacro formattedCode
  • - should validate type of receiver [ show source ]
    cell("DefaultMacro") should checkReceiverTypeOn(:formattedCode) 
    
    
inspect()

Returns a text inspection of the object

DefaultMacro inspect
  • - should return the code inside the macro [ show source ]
    macro(foo bar) inspect should ==("macro(foo bar)") 
    macro(123 +(444)) inspect should ==("macro(123 +(444))") 
    
    
  • - should prep) the name if it is available [ show source ]
    x = macro(foo bar) 
    cell(:x) inspect should ==("x:macro(foo bar)") 
    x = macro(123 +(444)) 
    cell(:x) inspect should ==("x:macro(123 +(444))") 
    
    
  • - should validate type of receiver [ show source ]
    cell("DefaultMacro") should checkReceiverTypeOn(:inspect) 
    
    
message()

returns the message chain for this macro

DefaultMacro message
  • - should validate type of receiver [ show source ]
    cell("DefaultMacro") should checkReceiverTypeOn(:message) 
    
    
name()

returns the name of the macro

DefaultMacro name
  • - should validate type of receiver [ show source ]
    cell("DefaultMacro") should checkReceiverTypeOn(:name) 
    
    
notice()

Returns a brief text inspection of the object

DefaultMacro notice
  • - should just return a simple description without code [ show source ]
    macro notice should ==("macro(...)") 
    macro(nil) notice should ==("macro(...)") 
    macro(foo bar xxxxxx) notice should ==("macro(...)") 
    
    
  • - should prep) the name if there is a name available [ show source ]
    x = macro 
    cell(:x) notice should ==("x:macro(...)") 
    x = macro(nil) 
    cell(:x) notice should ==("x:macro(...)") 
    x = macro(foo bar xxxxxx) 
    cell(:x) notice should ==("x:macro(...)") 
    
    
  • - should validate type of receiver [ show source ]
    cell("DefaultMacro") should checkReceiverTypeOn(:notice)