Re:A Square Is Not A Rectangle
by silentbicycle on Monday September 14, 2009 @08:06PM
(#822916)
Have you ever used a language that makes heavy use of pattern matching? Prolog, in particular, or to a lesser extent (due to increasing amounts of distraction by other novel features) Erlang, OCaml/SML, or Haskell. It sounds like you're essentially describing functional dispatch based on structural attributes or current characteristics, rather than a (generally fixed) object identity.
This is overall something I have been pondering (and recently planning and implementing) to extend the standard object orientation: adjectives (opposed to 'nouns' (objects) and 'verbs' (methods)).
An adjective would simply describe a noun furhter and simplify a dispatch inside a method depending on the state of an object.
Some pseudosyntax from the current state of ideas would go like this:
This goes pretty deep if one starts to think about it: * Buffers: empty, full, something in between * Abstract syntax trees: well-typed, ill-typed * Accounts: banned, active, moderator, adminBasically, it simplifies the pattern
I am just currently working on a dispatch mechanism which is at least a bit intuitive :)