Skip to content

Commit

Permalink
doc: Expand on the first argument to subst.
Browse files Browse the repository at this point in the history
Fixes #752
  • Loading branch information
jaqx0r committed Jul 15, 2023
1 parent 48a94f6 commit 1a24427
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions docs/Language.md
Expand Up @@ -444,11 +444,18 @@ program state.
in all lowercase.
* `subst(old, new, val)`, a function of three arguments which returns the
input `val` with all substrings or patterns `old` replaced by `new`. When
given a string for `old`, it is a direct proxy of the Go
given a *string* for `old`, it is a direct proxy of the Go
[strings.ReplaceAll](https://golang.org/pkg/strings/#ReplaceAll) function.
When given a regular expression pattern for `old`, it uses

`subst("old", "new", $val)`

When given a *regular expression pattern* for `old`, it uses
[regexp.ReplaceAllLiteralString](https://golang.org/pkg/regexp/#Regexp.ReplaceAllLiteralString).

`subst(/old/, "new", $val)`

Note the different quote characters in the first argument.

There are type coercion functions, useful for overriding the type inference made
by the compiler if it chooses badly. (If the choice is egregious, please file a
bug!)
Expand Down

0 comments on commit 1a24427

Please sign in to comment.