Skip to content

Commit

Permalink
Doc comment
Browse files Browse the repository at this point in the history
  • Loading branch information
WardBrian committed May 16, 2024
1 parent 141d768 commit f80f0c7
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions gui/src/app/tinystan/index.ts
Original file line number Diff line number Diff line change
@@ -172,6 +172,18 @@ export default class StanModel {
}
}

/**
* withModel serves as something akin to a context manager in
* Python. It accepts the arguments needed to construct a model
* (data and seed) and a callback.
*
* The callback takes in the model and a deferredFree function.
* The memory for the allocated model and any pointers which are "registered"
* by calling deferredFree will be cleaned up when the callback completes,
* regardless of if this is a normal return or an exception.
*
* The result of the callback is then returned or re-thrown.
*/
private withModel<T>(
data: string | StanVariableInputs,
seed: number,

0 comments on commit f80f0c7

Please sign in to comment.