Thoughts on peeling and readability

Paul Benedict pbenedict at apache.org
Thu Dec 10 22:33:04 UTC 2015


I truly like the peeling concept. Kudos Brian, Maurizio, et al.

My only difficulty is reading the source code that contains the peeling.
When I read it, I become concerned that mixing value-based blocks and an
object-based blocks diminishes comprehension. In a way, I feel transported
into C with preprocessor directives. :-) I wish there was cleaner
separation.

Three points:

1) In particular, I find reading most harmed when __WhereRef or ___WhereVal
is within a function. I don't like these blocks at all.

2) Declared at the method level, reading is easy -- because a method is
complete and distinct. This may be, in fact, the happy medium and the most
preferred way of coding it.

3) At the other extreme, have you explored allowing developers to write
semi-subclasses? Sorry for the poor term, but I don't know what else to
call it. Some of the Collection changes are incredibly big, and almost seem
like half-and-half code. I am concerned that when the division becomes so
enormous yet equal, maintainability will be difficult. Perhaps something
like this can be explored:

public abstract class AbstractCollection<any E> implements Collection<E> {
  // shared
}

// in same compilation unit
__WhereRef(E) AbstractCollection {
    public String toString() { ... }
}

// in same compilation unit
__WhereVal(E) AbstractCollection {
    public String toString() { ... }
}

Cheers,
Paul


More information about the valhalla-dev mailing list