1
0
mirror of https://github.com/janet-lang/janet synced 2025-10-26 05:07:41 +00:00

Abstract type getters can indicate key absence.

This change to the c api allows abstract types to indicate
to the runtime if a key was absent, or if it meant to return nil.
This commit is contained in:
Andrew Chambers
2019-12-09 16:50:33 +13:00
parent 4c5734c2ee
commit 57ccfb692c
8 changed files with 54 additions and 43 deletions

View File

@@ -894,7 +894,7 @@ struct JanetAbstractType {
const char *name;
int (*gc)(void *data, size_t len);
int (*gcmark)(void *data, size_t len);
Janet(*get)(void *data, Janet key);
int (*get)(void *data, Janet key, Janet *out);
void (*put)(void *data, Janet key, Janet value);
void (*marshal)(void *p, JanetMarshalContext *ctx);
void *(*unmarshal)(JanetMarshalContext *ctx);