Re: Boxing and Unboxing ??

Tech-Archive recommends: Fix windows errors by optimizing your registry




"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/


.



Relevant Pages

  • Re: C or C++
    ... that the beginner programmer is an adult --- they're like innocent ... it is indeed a simpler language (from a certain ... even though it is an extremely complex language, the complexity ...
    (comp.os.linux.development.apps)
  • Re: paul grahams arc, a new lisp, and his words about makign code ?shorter, vs forth?
    ... I can try approaches that I wouldn't try in a language like Forth because dealing with the low-level storage issues ends up dominating my development time. ... I believe there is in some sense a "conservation of complexity." ... Or, for the same problem, a programmer might choose a simple low-level language, but now have to tediously specify each and every step. ... I can't count the number of times I've had a programmer proudly hand me an exquisitely crafted set of routines that presented some utterly simple and consistent view of problem being solved. ...
    (comp.lang.forth)
  • Re: C vs. C++
    ... Then you need templates to try to control the mess. ... So one type of complexity is addressed by adding another layer of ... more often the human programmer cannot ... to debug than it would have been written in a simpler language. ...
    (comp.lang.c)
  • Re: Intercepting the text interpreter.
    ... the additional complexity they add to the language. ... You don't care about the programmer actually using the language. ... I don't think it adds complexity because my concern is for the conceptual complexity of the language. ... My examples point to reducing the number of concepts a programmer has to deal with when writing code. ...
    (comp.lang.forth)
  • Re: Java is becoming the new Cobol
    ... Believe me, I don't have a problem with complexity, when it's warranted. ... Several years later, a programmer ... graphics data compression algorithms, including an assembly language ... Since the data backs up my impressions, ...
    (comp.lang.cobol)