[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Scheme-reports] WG2 Scheme and Polymporphism
-----BEGIN PGP SIGNED MESSAGE-----
On 10/14/2011 01:07 PM, Denis Washington wrote:
> Now with the WG1 process nearing its final draft, I thought it might be
> time to think about what would be great to have in WG2. (I am neither a
> WG1 or WG2 member, but I care a lot about Scheme.) There seem to be
> quite a lot of ideas and proposals for this on the WG wiki already ,
> but I think that a major thing is missing that I would expect from a
> modern language in this age: first-class support for polymorphism and
> generic programming.
That would be nice, yes.
> - Adding generic variant to the set of WG1 procedures where appropiate,
> and/or redefining existing WG1 procedures to be generic. (For instance,
> "map" could be redefined to work on arbitrary sequences, with a new
> "list-map" procedure handling the special case of lists.)
That would finally close the niggling inconsistency of giving list
procedures nice names than the vector/string/etc equivalents ;-)
> - Adding a way for programmers to define new kinds of polymorphic (sets
> of) procedures.
> For the latter, I propose to look into adding something like the
> "protocols" feature of Clojure  into Scheme. In short, this feature
> allows the definition of a set of procedures that would have to be
> implemented for a type to "conform to the protocol".
Is that necessary, as opposed to a basic define-generic / define-method
mechanism? I'd quite like to see generic functions defined orthogonally
to records-with-inheritance, too, if possible. Although records are the
only standard way of creating disjoint user types, so there would
obviously be a tight linkage between the two in practice, I see no
reason to intertwine their semantics.
> This mechanism only supports single type-based dispatch, but in most
> cases this is all that is needed, and this is very efficient to
> implement on most platforms (the JVM and CLR have very fast single
> dispatch, for instance).
Aw, but multiply-dispatched generic functions are awesome!
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
-----END PGP SIGNATURE-----
Scheme-reports mailing list