Re: C# Language Specification - Extension Methods
- From: Lasse Vågsæther Karlsen <lasse@xxxxxxxxxxx>
- Date: Tue, 20 Sep 2005 18:35:12 +0200
Marshal wrote:
I think one of the major advancements on C# will be the growing support for Extension Methods and related concepts...
The current syntax involves a static class with static members using a warping of the "this" concept applied to function parameters. Surely we'll see more twisting and warping of language semantics as this technology evolves...
Rather than warp language symantics... It would be more apparently proper to allow something like:
(** Proposed syntax: public class global::System.String { public static string Encrypt(object key) { ... } } **)
Something generally synonymous with partial types... saying, hey look, you can even partialize an existing type. People will ooh and ahh over it... I can hear you doing it now as you prepare your rebuttle. Initially only static members would be allowed, but you could then provide support for more things without ever warping language concepts.
Currently, we have to teach... "this" means "this", unless it's on a parameter in an extension class, in which case it means "that".
And how would this be any less "warping" than the already proposed syntax? Adding a new "global" keyword and a "::" operator?
Wasn't it you that earlier was against introducing "where" as a new keyword? How's this different ?
If we're going to talk about new syntax for this, as well as introducing new keywords, then I like the following better (which I saw somewhere recently):
public class extend System.String { ....-- Lasse Vågsæther Karlsen http://www.vkarlsen.no/ mailto:lasse@xxxxxxxxxxx PGP KeyID: 0x2A42A1C2 .
- Prev by Date: Re: Database Connection questions.
- Next by Date: Re: Call Java library using C#
- Previous by thread: Re: C# Language Specification - Extension Methods
- Next by thread: Re: Passing enum wholly
- Index(es):