about summary refs log tree commit diff stats
path: root/058shape_shifting_recipe.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-03-19 15:57:10 -0700
committerKartik K. Agaram <vc@akkartik.com>2016-03-19 15:57:10 -0700
commit3ac523393d15d51b0fd1b042eab4f7cb539f68a9 (patch)
tree4de3879dda5682a2509dea4af52ecabc1b6f14a1 /058shape_shifting_recipe.cc
parent1f69d061c17d83b0a665c4fee2407fac1b714b68 (diff)
downloadmu-3ac523393d15d51b0fd1b042eab4f7cb539f68a9.tar.gz
2798 - experiment: split channels into two ends
This way when you pass one end to a function or routine, you can
implicitly give it the right to either read or write the channel, but
not both.

The cost: code gets more convoluted, names get more convoluted. You can
see this in particular in the test for buffer-lines. Let's see how it
goes..
Diffstat (limited to '058shape_shifting_recipe.cc')
-rw-r--r--058shape_shifting_recipe.cc15
1 files changed, 14 insertions, 1 deletions
diff --git a/058shape_shifting_recipe.cc b/058shape_shifting_recipe.cc
index 784b1fd0..2046c622 100644
--- a/058shape_shifting_recipe.cc
+++ b/058shape_shifting_recipe.cc
@@ -313,6 +313,7 @@ void compute_type_ingredient_mappings(const recipe& exemplar, const instruction&
   for (int i = 0; i < limit; ++i) {
     const reagent& exemplar_reagent = exemplar.products.at(i);
     reagent product = inst.products.at(i);
+    if (is_dummy(product)) continue;
     canonize_type(product);
     accumulate_type_ingredients(exemplar_reagent, product, mappings, exemplar, inst, caller_recipe, error);
   }
@@ -331,7 +332,8 @@ void accumulate_type_ingredients(const type_tree* exemplar_type, const type_tree
   if (!exemplar_type) return;
   if (!refinement_type) {
     // todo: make this smarter; only flag an error if exemplar_type contains some *new* type ingredient
-    raise << maybe(exemplar.name) << "missing type ingredient in " << exemplar_reagent.original_string << '\n' << end();
+    raise << maybe(exemplar.name) << "missing type ingredient for " << exemplar_reagent.original_string << '\n' << end();
+    raise << "  (called from '" << to_string(call_instruction) << "')\n" << end();
     return;
   }
   if (is_type_ingredient_name(exemplar_type->name)) {
@@ -649,6 +651,17 @@ container foo:_t [
 +mem: storing 0 in location 12
 +mem: storing 0 in location 13
 
+:(scenario shape_shifting_recipe_called_with_dummy)
+def main [
+  _ <- bar 34
+]
+def bar x:_t -> result:address:shared:_t [
+  local-scope
+  load-ingredients
+  result <- copy 0
+]
+$error: 0
+
 :(code)
 // this one needs a little more fine-grained control
 void test_shape_shifting_new_ingredient_does_not_pollute_global_namespace() {