FlowscopeDocs

P025

keyword used as a name

Severity Error

A reserved word (for example type, match, state, data, on, fn, for, in, strategy) was used as the name of a local, a parameter or a type field. Keywords keep their meaning everywhere, so they cannot name values.

Choose a descriptive name instead, such as kind, sideName or dataSource.

Failing example

Flowscope Script
script "Tape side"
data tape = subscribe(data.trades, minNotional: 250_000.0)
on tape.trade(tr) {
  let type = tr.isBuy ? "buy" : "sell"
  log.info(str.format("{0} {1}", type, str.formatVolume(tr.notional)))
}

Fixed example

Flowscope Script
script "Tape side"
data tape = subscribe(data.trades, minNotional: 250_000.0)
on tape.trade(tr) {
  let sideName = tr.isBuy ? "buy" : "sell"
  log.info(str.format("{0} {1}", sideName, str.formatVolume(tr.notional)))
}