From 6ca1ac7a6ce0a79a7d857d6e21825037c00ba0c3 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Wed, 23 Nov 2016 19:40:47 -0800 Subject: 3684 Trying to find examples where a layer includes complexity just so later layers can hook into it. Resolve_stack is the one big one I've found that isn't just a simple function-call indirection that may later get more complex. Conclusion of a conversation with Stephen Malina: Such examples should make one very nervous, because this sort of creep is how we end up with over-engineered abstractions (http://www.joelonsoftware.com/articles/fog0000000018.html). We need to step very carefully anytime we make the outsider reader's comprehension task harder.. --- html/054static_dispatch.cc.html | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'html/054static_dispatch.cc.html') diff --git a/html/054static_dispatch.cc.html b/html/054static_dispatch.cc.html index 476ddbb6..e4ebe241 100644 --- a/html/054static_dispatch.cc.html +++ b/html/054static_dispatch.cc.html @@ -187,7 +187,7 @@ Transform.push_back(//: We're punning the 'call' data structure just because it has slots for //: calling recipe and calling instruction. :(before "End Globals") -list<call> resolve_stack; +list<call> Resolve_stack; :(code) void resolve_ambiguous_calls(const recipe_ordinal r) { @@ -198,14 +198,15 @@ list<call> resolve_stack; if (inst.is_label) continue; if (non_ghost_size(get_or_insert(Recipe_variants, inst.name)) == 0) continue; trace(9992, "transform") << "instruction " << inst.original_string << end(); - resolve_stack.push_front(call(r)); - resolve_stack.front().running_step_index = index; + assert(Resolve_stack.empty()); + Resolve_stack.push_front(call(r)); + Resolve_stack.front().running_step_index = index; string new_name = best_variant(inst, caller_recipe); if (!new_name.empty()) inst.name = new_name; - assert(resolve_stack.front().running_recipe == r); - assert(resolve_stack.front().running_step_index == index); - resolve_stack.pop_front(); + assert(Resolve_stack.front().running_recipe == r); + assert(Resolve_stack.front().running_step_index == index); + Resolve_stack.pop_front(); } } @@ -236,7 +237,7 @@ string best_variant(instruction& inst// error messages if (get(Recipe_ordinal, inst.name) >= MAX_PRIMITIVE_RECIPES) { // we currently don't check types for primitive variants raise << maybe(caller_recipe.name) << "failed to find a matching call for '" << inst.original_string << "'\n" << end(); - for (list<call>::iterator p = /*skip*/++resolve_stack.begin(); p != resolve_stack.end(); ++p) { + for (list<call>::iterator p = /*skip*/++Resolve_stack.begin(); p != Resolve_stack.end(); ++p) { const recipe& specializer_recipe = get(Recipe, p->running_recipe); const instruction& specializer_inst = specializer_recipe.steps.at(p->running_step_index); if (specializer_recipe.name != "interactive") -- cgit 1.4.1-2-gfad0