forked from Matway/mpl-sl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMref.mpl
38 lines (31 loc) · 1017 Bytes
/
Mref.mpl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# Copyright (C) Matway Burkow
#
# This repository and all its contents belong to Matway Burkow (referred here and below as "the owner").
# The content is for demonstration purposes only.
# It is forbidden to use the content or any part of it for any purpose without explicit permission from the owner.
# By contributing to the repository, contributors acknowledge that ownership of their work transfers to the owner.
"control.Ref" use
"control.when" use
# Temporary solution until mplc supports recursive schemas
#
# Usage:
# myRef: @getSchema Mref; # mutable reference
# myRef: [getSchema Cref] Mref; # immutable reference
#
# getSchema is a function returning object or reference of the required schema
Mref: [{
INIT: [0nx !data];
DIE: [];
ASSIGN: [.data new !data];
CALL: [
data getSchema addressToReference @closure isConst [const] when
];
set: [
ref: getSchema Ref;
!ref
@ref storageAddress !data
];
virtual SCHEMA_NAME: "Mref";
virtual getSchema:;
data: 0nx;
}];