Regarding the Sequential interface:

There are a number of places where  (x instanceof Sequential) is taken
to imply something else about x:

 (a) that casting in the form of ((IPersistentCollection)x)  is okay,
or
 (b) that RT.seq(x) will succeed, or
 (c) that Rt.count(x) will succeed

Note that (a) implies (b) and (c).

In arbitrary code, these conclusions do not necessarily follow.

Occurrences (same in both pre- and post-lazy change codebases)

Type (a):

APersistentVector.doEquals
APersistentVector.doEquiv
PersistentQueue.equals
PersistentQueue.equiv
RT.nth


Type (b):

ASeq.equals
ASeq.equiv


Type (c):

PersistentList.EmptyList.equals


Sample code:  PersistentQueue.equals:

public boolean equals(Object obj){

        if(!(obj instanceof Sequential))
                return false;
        ISeq ms = ((IPersistentCollection) obj).seq();
...
}


Sample code:  ASeq.equiv:

public boolean equiv(Object obj){

        if(!(obj instanceof Sequential || obj instanceof List))
                return false;
        ISeq ms = RT.seq(obj);
    ...



The following interfaces extend Sequential:  IPersistentList,
IPersistentVector, ISeq

In core.clj, Sequential is used only in the definition of (sequential?
x).


Why does Sequential exist at all?  Why not just use
IPersistentCollection?
Are the listed interfaces the only ones intended to extend Sequential?
Is there an implicit charge to anyone extending/implementing
Sequential to guarantee (a), (b), (c)?

Put another way, is there any meaning to being Sequential but not
IPersistentCollection?

-- David
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to