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". 4 1929
Marshal,
Unfortunately, the argument doesn't hold. "global" is a language
concept in C#, and you are proposing changing that. Granted, it's not as
ubiquitious as "this", but it is still the same thing.
The same thing applies to other keywords as well. Return doesn't always
mean return. What happens when it is used in an attribute declaration, or
with yield?
It's like anything else, what it means depends on the context it is used
in.
The reason they chose "this" (at least as I see it) was twofold. The
first was to give some sort of indication that the extension method would be
applied to instances. "this" helps convey the idea of an instance pretty
well. The second was to help not introduce new keywords into the language
so as to reduce conflicts with pre-existing code. Your example in this case
helps prevent that as well, so it's applicable here. However, I don't see
"global" as a good way of saying "this should be applied to an instance".
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m
"Marshal" <Ma*****@discus sions.microsoft .com> wrote in message
news:4C******** *************** ***********@mic rosoft.com... 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".
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:la***@vk arlsen.no
PGP KeyID: 0x2A42A1C2
> public class extend System.String { ....
I like it... anything that reuses the concept of "partial types", or reuses
any existing concepts. As far as I know, "global", and "::" are official
elements already. The importance of them are to facilitate something like an
absolute scope versus a relative scope based on existing using statements.
I have always thought that static members should be accessible from instances
as well. I can keep them straight via strong naming and would have no
problems.
I recognize the validity of your comments. I do think my warp of "global" is
less severe than their warp of "this" however. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Randy Yates |
last post by:
In Harbison and Steele's text (fourth edition, p.111)
it is stated,
The C language does not specify the range of integers that the
integral types will represent, except ot say that type int may not
be smaller than short and long may not be smaller than int.
They go on to say,
Many implementations represent characters in 8 bits, type short in
|
by: evolnet.regular |
last post by:
I've been utilising C for lots of small and a few medium-sized personal
projects over the course of the past decade, and I've realised lately
just how little progress it's made since then. I've increasingly been
using scripting languages (especially Python and Bourne shell) which
offer the same speed and yet are far more simple and safe to use. I can
no longer understand why anyone would willingly use C to program
anything but the lowest...
|
by: emma middlebrook |
last post by:
Hi
Straight to the point - I don't understand why System.Array derives
from IList (given the methods/properties actually on IList).
When designing an interface you specify a contract. Deriving from an
interface and only implementing some of it means something is wrong:
either the interface specification is wrong e.g. not minimal or the
derivation is wrong e.g. the type can't actually honour this contract.
|
by: Merlin |
last post by:
I believe that interfaces are one of the more useful
design constructs available in C#. However, there's one
thing that I feel is missing in them. I propose that
interfaces be expanded to allow the specification of
constructors. Admittedly, this makes things a bit
confusing in that seeing constructors in an interface
seems to imply that the interface itself can be
instantiated. But I don't believe that it would be
significantly worse...
|
by: Eric Gunnerson [MS] |
last post by:
You may download the new specification at the C# Developer Center
(http://msdn.microsoft.com/vcsharp/language). There is a discussion forum
for the C# language on that same page.
If you don't own a copy of MS Word, you can download the free viewer at:
http://www.microsoft.com/downloads/details.aspx?FamilyID=9BBB9E60-E4F3-436D-A5A7-DA0E5431E5C1&displaylang=EN
| |
by: Scott Nonnenberg [MSFT] |
last post by:
This is really exciting stuff. We'll see you there!
It might be a good idea to do some background reading before you show up.
:0)
C# 3.0: http://msdn.microsoft.com/vcsharp/future/
The LINQ project: http://msdn.microsoft.com/netframework/future/linq/
C# 3.0 Language Enhancements
"Can't attend PDC but still want to talk to the C# team? This chat is your
|
by: Marshal [DirectX MVP 2003] |
last post by:
In anticipation of the chat, I have filtered all of my current enhancement
aleration ideas through the software development community, via the following
postings:
C# Language Specification - Delegates
C# Language Specification - Extension Methods
C# Language Specification - Enumeration
C# Language Specification - Generics
If anybody else has posted enhancement or alteration proposals in
|
by: S Chapman |
last post by:
In C# 3.0 there will be radical additions:
(#) "select, from, where" keywords allowing to query from SQL, XML,
collections, and more (Language integrated query (LINQ)) - >>Can
appreciate
(#) Object initialization : Customer c = new Customer();
c.Name="James"; becomes Customer c = new Customer { Name="James" }; -
>> Can appreciate
(*!!*) Lambda expressions : listOfFoo.Where(delegate(Foo x) { return
x.size>10;}) becomes...
|
by: Steffen Bobek |
last post by:
Extension methods are made for use with instances. I'd like to "misuse" them
as static methods, too. Let me tell you my ambition:
I use an extension method to serialize objects somehow like this:
MyObject obj = new MyObject();
obj.ToXmlFile("some directory\\some file.xml");
The method "ToXmlFile" is defined elsewhere far apart from MyObject to work
for all objects:
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |