Ted Leung on the air
Ted Leung on the air: Open Source, Java, Python, and ...
Mon, 10 Jan 2005
Generic Functions: sometimes it's just point of view

I agree with something that Dave Winer has said in the past, which is that some of the best blogs are the ones where you can watch people flesh their ideas out and learn along with them.

PJE is continuing his explorations with predicate dispatching, and you can follow the evolution of his thoughts:

On Wednesday:

Generic functions aren't always a substitute for adaptation and interfaces, however. Technically, a generic function can do anything that you can do by adapting to an interface and calling a method, but sometimes interface+adaptation is a better "metaphor" for what's going on, or a more convenient or expressive way to do things, especially for documentation. (For example, the interface I left behind in the new implementation was purely for documentation purposes.)

By Friday:

I'm beginning to think that predicate-dispatch generic functions capture something really fundamental about computation, or that at least they're much more fundamental than interfaces or adaptation. As useful as interfaces and adaptation are, they're actually pretty cumbersome compared to generic functions.

Now, this second insight is exactly the point of the predicate dispatch work, that it unifies single dispatch, multiple dispatch, ML style pattern matching, predicate classes and more. It's also important because there is a way to implement this efficiently.

I think that there's also something else going on, which is a rewiring of what it means for a thing to be an object. Much has been made of the virtues of encapsulation in object-oriented programming, and a typical reaction to Lisp style generic functions (or Python's single dispatching object system) is that there isn't any encapsulation, and that having everything work as functions is not really object-oriented. But maybe it's the case that being "object oriented" is not the primary goal. If reduction of unnecessary code and the ability to extend the system are what's most important, then generic functions (even without predicate dispatching) are a very powerful tool. Interfaces and adaptation (which becomes necessary by virtue of the existence of interfaces) are concepts from a very object-centric view of the world. If you remove that view, then the landscape looks very different.

[09:02] | [computers/programming] | # | TB | F | G | 1 Comments | Other blogs commenting on this post
You can subscribe to an RSS feed of the comments for this blog: RSS Feed for comments

Add a comment here:

You can use some HTML tags in the comment text:
To insert a URI, just type it -- no need to write an anchor tag.
Allowable html tags are: <a href>, <em>, <i>, <b>, <blockquote>, <br/>, <p>, <code>, <pre>, <cite>, <sub> and <sup>.

You can also use some Wiki style:
URI => [uri title]
<em> => _emphasized text_
<b> => *bold text*
Ordered list => consecutive lines starting spaces and an asterisk

Name:


E-mail:


URL:


Comment:


Remember my info?


twl JPG

About

Ted Leung FOAF Explorer

I work at the Open Source Applications Foundation (OSAF).
The opinions expressed here are entirely my own, not those of my employer.

Creative Commons License
This work is licensed under a Creative Commons License.

Now available!
Professional XML Development with Apache Tools : Xerces, Xalan, FOP, Cocoon, Axis, Xindice
Technorati Profile
PGP Key Fingerprint
My del.icio.us Bookmarks
My Flickr Photos


Syndicate
RSS 2.0 xml GIF
Comments (RSS 2.0) xml GIF
Atom 0.3 feed
Feedburner'ed RSS feed

< January 2005 >
SuMoTuWeThFrSa
       1
2 3 4 5 6 7 8
9101112131415
16171819202122
23242526272829
3031     

Archives
2006
2005
2004
2003

Articles
Macintosh Tips and Tricks

Search
Lucene
Blogs nearby
geourl PNG

Categories
/ (1567)
  books/ (33)
  computers/ (62)
    hardware/ (15)
    internet/ (58)
      mail/ (11)
      microcontent/ (58)
      weblogs/ (174)
        pyblosxom/ (36)
      www/ (25)
    open_source/ (145)
      asf/ (53)
      osaf/ (32)
        chandler/ (35)
        cosmo/ (1)
    operating_systems/ (16)
      linux/ (9)
        debian/ (15)
        ubuntu/ (2)
      macosx/ (101)
        tips/ (25)
      windows_xp/ (4)
    programming/ (156)
      clr/ (1)
      dotnet/ (13)
      java/ (71)
        eclipse/ (22)
      lisp/ (34)
      python/ (86)
      smalltalk/ (4)
      xml/ (18)
    research/ (1)
    security/ (4)
    wireless/ (1)
  culture/ (10)
    film/ (8)
    music/ (6)
  education/ (13)
  family/ (17)
  gadgets/ (24)
  misc/ (47)
  people/ (18)
  photography/ (25)
    pictures/ (12)
  places/ (3)
    us/ (0)
      wa/ (2)
        bainbridge_island/ (17)
        seattle/ (13)
  skating/ (6)
  society/ (20)



[Valid RSS]

del.icio.us linkblog

www.flickr.com

Blogroll

java.blogs
Listed on BlogShares

Locations of visitors to this page
Where are visitors to this page?


pyblosxom GIF