Tuesday, July 17, 2018

Swift GYB

Mattt Thompson:

GYB is a lightweight templating system that allows you to use Python code for variable substitution and flow control:

  • The sequence %{ <#code#> } evaluates a block of Python code
  • The sequence % <#code#>: … % end manages control flow
  • The sequence ${ <#code#> } substitutes the result of an expression

All other text is passed through unchanged.

A good example of GYB can be found in Codable.swift.gyb.

1 Comment RSS · Twitter

Just in case anyone was still laboring under the charmingly naive belief that #SwiftLang wasn't a total #TrashHouse.


Leave a Comment