Re: Boxing and Unboxing ??
- From: "Peter Olcott" <NoSpam@xxxxxxxxxxxxx>
- Date: Sun, 14 Jan 2007 15:23:05 -0600
"Barry Kelly" <barry.j.kelly@xxxxxxxxx> wrote in message
news:834lq2ldaddh10kl92hlgt97l55q6jka18@xxxxxxxxxx
Peter Olcott wrote:
"Barry Kelly" <barry.j.kelly@xxxxxxxxx> wrote in message
news:021lq2hhan21n5f99r6cbif6id0k5tlhrc@xxxxxxxxxx
Peter Olcott wrote:
It also increases language complexity, which can increase programmer
effort.
It reduces complexity.
I disagree.
Right glance at a couple of words before forming the preconceived refutation.
Unless we're in fantasy land and we're talking about a
completely different language here, adding *anything* to C# is going to
increase its complexity, by definition. Any new feature needs to add
enough value to justify itself.
Add [in] remove [ref] the net difference is no more elements. However we are
adding one simple parameter qualifier and removing a complex qualifier.
The programmer would not even need to know what the terms
reference type and value type means much less explicitly distinguish when one
is
more appropriate than the other.
Which programmer are you talking about:
The one writing the programs in the C# language.
1) The guy instantiating types and calling methods? If the types are
well-designed, this guy typically doesn't need to know already.
1) The guy writing types and methods? This is the guy who needs to make
the choice, so unless the two become semantically identical, he needs to
know the difference. And if you're suggesting some kind of semantic
fusion, then you'll need to be a whole lot more specific about what
you're talking about.
There are programmers that only call methods and never write methods? That seems
like quite a stretch. Where do they put the code that calls the methods, if not
in another method?
There would only be two types of parameters;
[out] I want to be able to change it in the function
and [in], I want to make
sure that it won't be changed in the function,
and neither one of these ever has
to be passed by value.
The underlying CLR can pass by value if it is quicker
than by reference for items of the size of [int] and smaller.
I had a long reply composed, but I discarded it, because I realised that
your statements don't cohere into a fully-formed whole.
You need to expand much more on what you're talking about, with
precision and detail, and give example code.
int SomeMethod(in SomeType SomeName) // C#
Exactly Equals
int SomeMethod(const SomeType& SomeName) // C++
And don't forget, you can't break any existing C# code or semantics.
The [ref]
parameter qualifier could be discarded.
No it can't! You've just renamed it to 'out' above.
I took two different existing parameter qualifiers and combined them into a
single parameter qualifier that accomplished the purpose of both. Like I said
[ref] can be discarded. Is there really a need to make sure that a parameter
that will be written to was initialized?
There is no useful distinction between [ref] and [out]. Unify [ref] and [out]
into [out], and add [in] as a read-only pass by address parameter qualifier. The
CLR can be free to pass by value if it would be faster for very small items,
because on a read-only parameter there is no semantic difference.
-- Barry
--
http://barrkel.blogspot.com/
.
- Follow-Ups:
- Re: Boxing and Unboxing ??
- From: Arne Vajhøj
- Re: Boxing and Unboxing ??
- From: Barry Kelly
- Re: Boxing and Unboxing ??
- References:
- Re: Boxing and Unboxing ??
- From: Bob Graham
- Re: Boxing and Unboxing ??
- From: Peter Olcott
- Re: Boxing and Unboxing ??
- From: Arne Vajhøj
- Re: Boxing and Unboxing ??
- From: Peter Olcott
- Re: Boxing and Unboxing ??
- From: Barry Kelly
- Re: Boxing and Unboxing ??
- From: Peter Olcott
- Re: Boxing and Unboxing ??
- From: Barry Kelly
- Re: Boxing and Unboxing ??
- From: Peter Olcott
- Re: Boxing and Unboxing ??
- From: Barry Kelly
- Re: Boxing and Unboxing ??
- From: Barry Kelly
- Re: Boxing and Unboxing ??
- From: Peter Olcott
- Re: Boxing and Unboxing ??
- From: Barry Kelly
- Re: Boxing and Unboxing ??
- Prev by Date: Re: 'using' statements
- Next by Date: Re: Boxing and Unboxing ??
- Previous by thread: Re: Boxing and Unboxing ??
- Next by thread: Re: Boxing and Unboxing ??
- Index(es):
Relevant Pages
|