ziglings icon indicating copy to clipboard operation
ziglings copied to clipboard

fix typo

Open unional opened this issue 3 years ago • 4 comments

unional avatar Aug 10 '22 07:08 unional

@unional Hmmm... I'm more used to seeing "reference to".

It's not a formal survey, but I see these stats when searching stackoverflow.com:

"reference to"  352,609 results
"reference of"   35,780 results

I tend to strong associate "to" with pointers as well - "pointer to" instead of "pointer of".

Change my mind! :-)

ratfactor avatar Aug 11 '22 19:08 ratfactor

I see. :)

When I read Let's pass a reference to num to our function... it just look weird and have to stop and rethink what it means.

When I try Let's pass a reference of num to our function... then it clicks as (reference of num) can be substituted with the reference, i.e. Let's pass "the reference" to our function.

When using reference to num, it focus on the relationship, i.e. that is the reference to something, instead of emphasize on the reference itself.

It is relatively minor and maybe you can leave it as is. 🍻

unional avatar Aug 11 '22 19:08 unional

@unional Oh, thank you! Yes, I see what you mean. Using "to" twice in Let's pass a reference to num to our function... is not good. Let's find a way to re-word that sentence entirely to avoid the confusion!

How about we change:

    // Let's pass a reference to num to our function and print it:

by removing "to our function" entirely:

    // Let's pass a reference to num, then print the result:

What do you think?

ratfactor avatar Aug 19 '22 13:08 ratfactor

How about even skip the latter part? It describes the next two lines, but what's really important is just the first line. This is the same for the next comment.

i.e. update that section to:

    // Let's pass a reference to num:
    makeFive(&num);
    std.debug.print("num: {}, ", .{num});

    // Now something interesting. Let's pass a reference to a
    // specific array value:
    makeFive(&more_nums[2]);

    // [also remove this comment, doesn't add anything to the exercise (pass by reference)]
    std.debug.print("more_nums: ", .{});
    for (more_nums) |n| {
        std.debug.print("{} ", .{n});
    }

🍺

unional avatar Aug 19 '22 15:08 unional

How about we change: ... by removing "to our function" entirely:

    // Let's pass a reference to num, then print the result:

My suggestion would be: Let's pass the num reference to our function and print it:

chrboesch avatar Jan 08 '23 21:01 chrboesch