Skip to content

(mem)

field access expressions

clojure
(mem field? value?)

Where:

  1. field: field name (the b in a.b) *
  2. value: receiver expression (the a in a.b) *

Matching:

  1. field access, e.g. value.field
  2. chained access, e.g. value.field.subfield

Behavior

  • When value is provided and the receiver is a chained access, it matches the inner field name (so (mem _ config) matches settings.config.value).

Examples

Find accesses to secrets on a config struct.

clojure
(mem secret (id config))

Selects in lines { 1 } but not in { 2, 3 }:

rust
let token = config.secret;
let token = settings.secret;
let level = config.verbose;

Locate chained accesses that go through a config field.

clojure
(mem _ config)

Selects in lines { 1 } but not in { 2 }:

rust
let path = settings.config.value;
let path = settings.env.value;

Arguments

field

• Identifier: shorthand for (id)
• Pattern: shorthand for (id)
(id)
(:into) (:and) (:or) (:not) (:text) (:kind) (:replace) (:capture)

value

• Identifier: shorthand for (id)
• Pattern: shorthand for (id)
(call) (enum) (fun) (id) (mem) (num) (str) (:ref) (:into) (:and) (:or) (:not) (:text) (:kind) (:replace) (:capture)

Copyright © 2022-present Semantic Works, Inc.