Alp Mestan wrote:
Indeed, OCaml has stuctural polymorphism, it's a wonderful feature.
*# let f myobj = myobj#foo Hi !;;
val f : foo : string - 'a; .. - 'a = fun*
And Haskell has that too:
-- This is how we define labels.
data Field1 deriving Typeable; field1 = proxy::Proxy Field1
--
Haskell's records are a bit annoying, and type-classes often group together
too many methods, which means you make early decisions about future unknown
requirements, and IMO you always get it wrong :-)
After having read an email in the cafe about the Noop language Self
language, I realized that
Short answer: There is no good way of doing what you want.
This is actually one of my biggest annoyances with haskell (right up there
with disallowing infinite types). They are many techniques that work better
or worse depending on the application, but non are very satisfactory IMO.
Your typeclass
On Fri, Sep 25, 2009 at 8:14 PM, Job Vranish jvran...@gmail.com wrote:
Supposedly OCaml has an OO feature that does this but I haven't tried it
out.
Indeed, OCaml has stuctural polymorphism, it's a wonderful feature.
*# let f myobj = myobj#foo Hi !;;
val f : foo : string - 'a; .. - 'a =
On Fri, 25 Sep 2009 23:25:21 +0200, you wrote:
On Fri, Sep 25, 2009 at 8:14 PM, Job Vranish jvran...@gmail.com wrote:
Supposedly OCaml has an OO feature that does this but I haven't tried it
out.
Indeed, OCaml has stuctural polymorphism, it's a wonderful feature.
*# let f myobj = myobj#foo
On Fri, 25 Sep 2009 23:25:21 +0200, you wrote:
On Fri, Sep 25, 2009 at 8:14 PM, Job Vranish jvran...@gmail.com wrote:
Supposedly OCaml has an OO feature that does this but I haven't tried it
out.
Indeed, OCaml has stuctural polymorphism, it's a wonderful feature.
*# let f myobj = myobj#foo
Peter Verswyvelen wrote:
After having read an email in the cafe about the Noop language Self
language, I realized that what I really would like to have is strong duck
typing on records (or is it called structural subtyping? or
prototype-based-objects? or something like that)
The common name
On Fri, Sep 25, 2009 at 10:55 PM, Casey Hawthorne cas...@istar.ca wrote:
On Fri, 25 Sep 2009 23:25:21 +0200, you wrote:
On Fri, Sep 25, 2009 at 8:14 PM, Job Vranish jvran...@gmail.com wrote:
Supposedly OCaml has an OO feature that does this but I haven't tried it
out.
Indeed, OCaml