Why Strings as Classes?

Dee Girl deegirl at noreply.com
Wed Aug 27 20:40:13 PDT 2008


Chris R. Miller Wrote:

> superdan wrote:
> > Chris R. Miller Wrote:
> >> Furthermore, you're faulting linked lists as having a bad opIndex.  Why
> >> not implement a cursor (Java LinkedList-like iterator) in the opIndex
> >> function?  Thus you could retain the reference to the last indexed
> >> location, and simply use that instead of the root node when calling
> >> opIndex.  Granted that whenever the contents of the list are modified
> >> that reference would have to be considered invalid (start from the root
> >> node again), but it'd work with an O(1) efficiency for sequential
> >> accesses from 0 to length.  True, it'll add another pointer to a node in
> >> memory, as well as a integer representing the position of that node
> >> reference.
> > 
> > you: "this scent will make skunk farts stink less."
> > me: "let's kick the gorram skunk outta here!"
> 
> I would imagine that you'll have a hard time convincing others that
> linked-lists are evil when you apparently have two broken shift keys.
> 
> >> Wrong.  It works.  That it's not precisely what the spec for sort
> >> dictates (which is probably in error, since no spec can guarantee a
> >> precise efficiency if it doesn't know the precise container type).
> > 
> > sure it can. in big oh.
> 
> Which is simply identifying the algorithm used by its efficiency.  If
> you're not familiar with the types of algorithms, it tells you the
> proximate efficiency of the algorithm used.  If you are familiar with
> algorithms, then you can identify the type of algorithm used so you can
> better leverage it to do what you want.
> 
> >>  You
> >> are also misinterpreting the spec.  It is saying that it uses a specific
> >> efficiency of algorithm, not that you can arbitrarily expect a certain
> >> efficiency out of it regardless of how dumb you might be with the choice
> >> of container you use.
> > 
> > in stl the spec says as i say. in d the spec is not precise. it should.
> 
> Yes, it probably should explicitly say that "sort uses the xxxxx
> algorithm, which gives a proximate efficiency of O(n log n) when used
> with optimal data structures."
> 
> You honestly cannot write a spec for generic programming and expect
> uniform performance.

But this is what STL did. Sorry, Dee Girl



More information about the Digitalmars-d mailing list