Re: [Scheme-reports] WG2 Scheme and Polymporphism
Alaric Snell-Pym 14 Oct 2011 12:20 UTC
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 10/14/2011 01:07 PM, Denis Washington wrote:
> Hello,
>
> 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 [1],
> 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 [2] 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!
ABS
- --
Alaric Snell-Pym
http://www.snell-pym.org.uk/alaric/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk6YKPAACgkQRgz/WHNxCGqx3wCfetf4jD3Pfx6QUmsmX8b78X+H
JnMAn0t/0H2pdBAbC50cgzYV797sFV9d
=tnIA
-----END PGP SIGNATURE-----
_______________________________________________
Scheme-reports mailing list
Scheme-reports@scheme-reports.org
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports