diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2015-11-13 14:32:21 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2015-11-13 14:36:18 -0800 |
commit | e36e7caffa6194135895844aae9df93d1af4b9f9 (patch) | |
tree | 9ed97c9ac3190034b8361c0937c4ba064eef4573 /021check_instruction.cc | |
parent | c4f5d4cf0b6f0d33994aac9d5fa29da1a46f7831 (diff) | |
download | mu-e36e7caffa6194135895844aae9df93d1af4b9f9.tar.gz |
2432 - first stab at making ingredients immutable
The rule is, an address ingredient is only modifiable if: a) it's also a product b) it's /contained-in some other ingredient+product Only if an ingredient is a modifiable can you: a) call get-address or index-address on it (the only way to write to it) b) call other recipes that also return it in a product I still don't check copies of the address. That's next. Core mu passes this check, but none of the example apps do. edit/ and sandbox/ are known to fail.
Diffstat (limited to '021check_instruction.cc')
-rw-r--r-- | 021check_instruction.cc | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/021check_instruction.cc b/021check_instruction.cc index 1d831369..5e258b9b 100644 --- a/021check_instruction.cc +++ b/021check_instruction.cc @@ -73,6 +73,8 @@ recipe main [ +error: main: can't copy 34 to 1:address:number; types don't match :(code) +// copy arguments because later layers will want to make changes to them +// without perturbing the caller bool types_match(reagent lhs, reagent rhs) { // '_' never raises type error if (is_dummy(lhs)) return true; |