Some bogus examples and statements

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Andre

    #1

    Some bogus examples and statements

    Why is it that most of the articles found on the net (written by
    professional authors) and books (such as Sams .NET CLR Unleashed) give
    bogus examples and state incorrectly that "reference-types are passed by
    reference" in C#? They are *not*. Almost out of 10 articles, 9 make such
    a statement. Recently I read an article by Jeffrey Ritcher on Arrays in
    ..NET, under the Passing and returning Arrays section it states "Arrays
    are always passed by reference to a method" as the first line. I thought
    Jeffrey would know better? Don't people at MSDN proof read these
    articles? Isn't that claim wrong? What's the matter with people!

    -Andre

  • Andre

    #2
    Re: Some bogus examples and statements

    > In the context of the article and the point JR is trying to make, I think[color=blue]
    > his statement is fair. At the lowest level, method arguments may be passed
    > by value, but when you look at it from a higher level of abstraction, the
    > method does receive a reference to the original array.[/color]

    True.. but saying 'Arrays are always passed by reference'.. the stress
    here is on the phrase 'passing by reference' as we all know.. 'passing
    by reference' has a strict and exact meaning in C# and I think it's a
    little misleading. I'm sure adding another line saying: All types in C#
    are passed by value. Given that a reference type variable holds a
    reference to the actual object, in case of arrays (which is a reference
    type), a copy of the reference held by the array variable is passed onto
    the method (i.e by value) and so method now has a local variable holding
    a copy of the reference referring to the actual array on the heap.

    I'm sure the above could be further summarized .. my point is... saying
    "passed by reference" is incorrect especially when it holds a specific
    meaning to the language.

    The key point being[color=blue]
    > that a copy of the array IS NOT made and passed to the method.[/color]

    Exactly.. you described it to me in a line, so could JR, right? He *did*
    write a lenghty article only on Arrays, and I'm sure clarifying a few
    lines wouldn't have hurt.
    [color=blue]
    > I can assure you that the people at MSDN do proof read articles and if JR
    > had of said "Arrays are always passed by value to a method...", then
    > somebody would have been asking questions; yourself included no doubt.[/color]

    Not really - unless what you stated wouldn't have been further explained
    (by a small example perhaps?)
    [color=blue]
    > of being a good writer is knowing what to include and what not to include.
    > In the case of this article, to accurately describe how things really work,
    > would have required JR to branch off into a side discussion that was out of
    > context, confusing for the reader, and added little to the article.[/color]

    Confusing? I disagree. Since I'd read the article only to learn more
    about arrays in the first place, I'd love to read a bit more (especially
    when it really really matters). One branches off when the discussion at
    hand is indirectly or in some way not related to the main topic.

    The 9 articles I talked about can be found on websites such as
    codeproject.com or other websites that host articles written on C# (I
    readlly don't remember - but I can find them for you if you really want
    to know).

    -Andre

    Comment

    • Henrik Dahl

      #3
      Re: Some bogus examples and statements

      Andre,

      Couldn't you try to give an example where your attempt for clarification
      actually settles an ambiguity or generally solves an issue?


      Best regards,

      Henrik Dahl



      "Andre" <food_crazy@hot mail.com> wrote in message
      news:3f24f6f0$1 @clarion.carno. net.au...[color=blue][color=green]
      > > In the context of the article and the point JR is trying to make, I[/color][/color]
      think[color=blue][color=green]
      > > his statement is fair. At the lowest level, method arguments may be[/color][/color]
      passed[color=blue][color=green]
      > > by value, but when you look at it from a higher level of abstraction,[/color][/color]
      the[color=blue][color=green]
      > > method does receive a reference to the original array.[/color]
      >
      > True.. but saying 'Arrays are always passed by reference'.. the stress
      > here is on the phrase 'passing by reference' as we all know.. 'passing
      > by reference' has a strict and exact meaning in C# and I think it's a
      > little misleading. I'm sure adding another line saying: All types in C#
      > are passed by value. Given that a reference type variable holds a
      > reference to the actual object, in case of arrays (which is a reference
      > type), a copy of the reference held by the array variable is passed onto
      > the method (i.e by value) and so method now has a local variable holding
      > a copy of the reference referring to the actual array on the heap.
      >
      > I'm sure the above could be further summarized .. my point is... saying
      > "passed by reference" is incorrect especially when it holds a specific
      > meaning to the language.
      >
      > The key point being[color=green]
      > > that a copy of the array IS NOT made and passed to the method.[/color]
      >
      > Exactly.. you described it to me in a line, so could JR, right? He *did*
      > write a lenghty article only on Arrays, and I'm sure clarifying a few
      > lines wouldn't have hurt.
      >[color=green]
      > > I can assure you that the people at MSDN do proof read articles and if[/color][/color]
      JR[color=blue][color=green]
      > > had of said "Arrays are always passed by value to a method...", then
      > > somebody would have been asking questions; yourself included no doubt.[/color]
      >
      > Not really - unless what you stated wouldn't have been further explained
      > (by a small example perhaps?)
      >[color=green]
      > > of being a good writer is knowing what to include and what not to[/color][/color]
      include.[color=blue][color=green]
      > > In the case of this article, to accurately describe how things really[/color][/color]
      work,[color=blue][color=green]
      > > would have required JR to branch off into a side discussion that was out[/color][/color]
      of[color=blue][color=green]
      > > context, confusing for the reader, and added little to the article.[/color]
      >
      > Confusing? I disagree. Since I'd read the article only to learn more
      > about arrays in the first place, I'd love to read a bit more (especially
      > when it really really matters). One branches off when the discussion at
      > hand is indirectly or in some way not related to the main topic.
      >
      > The 9 articles I talked about can be found on websites such as
      > codeproject.com or other websites that host articles written on C# (I
      > readlly don't remember - but I can find them for you if you really want
      > to know).
      >
      > -Andre
      >[/color]


      Comment

      • Henrik Dahl

        #4
        Re: Some bogus examples and statements

        Andre,

        But is it possible for you to illustrate a situation where you've clarified
        something in what you write?


        Best regards,

        Henrik Dahl

        "Andre" <food_crazy@hot mail.com> wrote in message
        news:3F2551B6.5 0208@hotmail.co m...[color=blue]
        > :) Well... actually no I dont have a solution.. I can't stop people from
        > writing what they will but I was hoping MSDN would be more careful next
        > time :)
        >
        >
        > -Andre
        >
        > Henrik Dahl wrote:[color=green]
        > > Andre,
        > >
        > > Couldn't you try to give an example where your attempt for clarification
        > > actually settles an ambiguity or generally solves an issue?
        > >
        > >
        > > Best regards,
        > >
        > > Henrik Dahl
        > >
        > >
        > >
        > > "Andre" <food_crazy@hot mail.com> wrote in message
        > > news:3f24f6f0$1 @clarion.carno. net.au...
        > >[color=darkred]
        > >>>In the context of the article and the point JR is trying to make, I
        > >>[/color]
        > > think
        > >[color=darkred]
        > >>>his statement is fair. At the lowest level, method arguments may be
        > >>[/color]
        > > passed
        > >[color=darkred]
        > >>>by value, but when you look at it from a higher level of abstraction,
        > >>[/color]
        > > the
        > >[color=darkred]
        > >>>method does receive a reference to the original array.
        > >>
        > >>True.. but saying 'Arrays are always passed by reference'.. the stress
        > >>here is on the phrase 'passing by reference' as we all know.. 'passing
        > >>by reference' has a strict and exact meaning in C# and I think it's a
        > >>little misleading. I'm sure adding another line saying: All types in C#
        > >>are passed by value. Given that a reference type variable holds a
        > >>reference to the actual object, in case of arrays (which is a reference
        > >>type), a copy of the reference held by the array variable is passed onto
        > >>the method (i.e by value) and so method now has a local variable holding
        > >>a copy of the reference referring to the actual array on the heap.
        > >>
        > >>I'm sure the above could be further summarized .. my point is... saying
        > >>"passed by reference" is incorrect especially when it holds a specific
        > >>meaning to the language.
        > >>
        > >>The key point being
        > >>
        > >>>that a copy of the array IS NOT made and passed to the method.
        > >>
        > >>Exactly.. you described it to me in a line, so could JR, right? He *did*
        > >>write a lenghty article only on Arrays, and I'm sure clarifying a few
        > >>lines wouldn't have hurt.
        > >>
        > >>
        > >>>I can assure you that the people at MSDN do proof read articles and if
        > >>[/color]
        > > JR
        > >[color=darkred]
        > >>>had of said "Arrays are always passed by value to a method...", then
        > >>>somebody would have been asking questions; yourself included no doubt.
        > >>
        > >>Not really - unless what you stated wouldn't have been further explained
        > >>(by a small example perhaps?)
        > >>
        > >>
        > >>>of being a good writer is knowing what to include and what not to
        > >>[/color]
        > > include.
        > >[color=darkred]
        > >>>In the case of this article, to accurately describe how things really
        > >>[/color]
        > > work,
        > >[color=darkred]
        > >>>would have required JR to branch off into a side discussion that was[/color][/color][/color]
        out[color=blue][color=green][color=darkred]
        > >>[/color]
        > > of
        > >[color=darkred]
        > >>>context, confusing for the reader, and added little to the article.
        > >>
        > >>Confusing? I disagree. Since I'd read the article only to learn more
        > >>about arrays in the first place, I'd love to read a bit more (especially
        > >>when it really really matters). One branches off when the discussion at
        > >>hand is indirectly or in some way not related to the main topic.
        > >>
        > >>The 9 articles I talked about can be found on websites such as
        > >>codeproject.c om or other websites that host articles written on C# (I
        > >>readlly don't remember - but I can find them for you if you really want
        > >>to know).
        > >>
        > >>-Andre
        > >>[/color]
        > >
        > >
        > >[/color]
        >[/color]


        Comment

        Working...