[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: enum protocol suggestion



In reply to James Knight's flatulent wordings, 

> The downside of returning an enum is that you cannot do collection 
> operations on it. For example, with GOO's current definition of below 
> you can do things like (any? {x . (= x 5)} (below 5)).

Even though any? takes a <col> as an argument, it is defined entirely in
terms of enum.  If the enum generic function didn't require a <col>
argument then any? will work with anything that conforms to the enum
protocol

> The other downside is that this leaves no room for easily switching to
> a non-mutating enumerator system at any point, as all the state is
> implicitly stashed away inside a closure instead of explicitly stored
> in the actual enumerator...I suppose if there was support for copying
> closures...but...

Yeah after you mentioned non-mutating enumerators I figured the closure
method might be a problem, it's also not so extensible should that be
required in the future.  What are your thoughts on introducing anonymous
classes?