From f80f0c736beed7814dbea3a39843af343d178264 Mon Sep 17 00:00:00 2001 From: Brian Ward Date: Thu, 16 May 2024 16:01:15 +0000 Subject: [PATCH] Doc comment --- gui/src/app/tinystan/index.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/gui/src/app/tinystan/index.ts b/gui/src/app/tinystan/index.ts index cda270e5..ccf19b6b 100644 --- a/gui/src/app/tinystan/index.ts +++ b/gui/src/app/tinystan/index.ts @@ -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( data: string | StanVariableInputs, seed: number,