ash-project / igniter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Clarify and/or rename `highest_adjacent_block.

zachdaniel opened this issue · comments

Original question posed:

The name Igniter.Code.Common.highest_adjacent_block/1 was a bit confusing to me (perhaps because the code nests left<->right while AST nests up<->down, and it's unclear which mode of thinking was necessary). How's something like outer_containing_block/1? (Separately, wouldn't it always return defmodule's block? Or maybe I'm misunderstanding the functionality.)

My thoughts:

I think a bette name is definitely in order. It only goes to the "outermost" block that is only a {:__block__, and it only goes up the tree while it is findings {:__block__. So if it gets to something like {:def, ....} it would not continue going up. That is the adjacent part of that. I will see if I can think of a better name for it.

@ibarakaiev I can't really think of a better name yet. It's a private function so there isn't really a rush to get it figured out. I think I'll actually close this for now since it's not a public function....yeah, gunna not worry about it for now.