but anyway - now that weve established at much greater length than I anticipated that theres no difference between

sort in C, which is just as fast.

oh, it's easy to show how references can be faster than pointers.
you just need the referenced objects to be immutable and small enough to encode into a reference.
things like chars and integers tend to do nicely.
the cost of references is the cost of communication between aliases
with immutables, there is no need to communicate between the aliases, since they can't have anything interesting to say to one another.

but anyway - now that we've established (at much greater length than I anticipated) that there's no difference between calling f(x) where f is defined as void f(int &x){x++;} and calling f(&x) where f is defined as void f(int *x){(*x)++;}, why can't "pass by reference" be used to refer to what these functions have in common, rather than to what is different between them?

because they pass by value.
the reason is the same reason that you do not call 'C' 'python'

Why does it have to be generic?

even though you can implement 'python' in 'C'.

In the same way that we can talk about object-oriented programming in C even though C doesn't provide support for e.g. having a method on a struct that you can call s-foo() and have foo automatically receive a pointer (or reference) to 's'

you can emulate various oop mechanisms in C, but C does not provide any support for oop mechanisms.
same with references.

Because it has to be as reuseable as much as possible, and demonstrates the advantage of using templates and references rather than using macros and pointers.

doesn't stop lots of people from talking about doing OOP in C

so you can talk about 'emulating pass by reference by passing pointers by value' if you want.

it's a programming technique, not a language feature.

lots of people are stupid.

And I don't see how pass by reference is different

what is OOP?

on that, we agree. We simply happen to differ on _which_ groups of people are stupid :P

Zhivago, I'm not
:P

you prefer to think that there is no difference between having something, and implementing something which has something over the top of what you have.
you miss the layers involved — which is why your logic draws you to conclusions such as "assembly is C"
or "references are pointers"

no, I prefer to think of "pass by reference" as being the thing you implement, rather than the thing you (don't) have.

see above — that logic is inescapably defective.

no, for the same reason that if you write a python interpreter, you have implemented python in C, rather than having implemented "emulating python with C" in C

apply that argument to references.
you can't have it both ways.

Oh?
You can't "implement Python", but you can write an interpreter for it.

have the python people, then, not implemented python?

would you use terminology like "virtual" "methods" to refer to those functions?

or are you trying to interpose trademark, or, worse, some nebulously-defined extralegal mystical 'name right', into natural english usage

I would prefer "horrible hack".

We're talking about any python implementation.

But I suppose that's what compilers do behind the scenes anyway.

Arafangion and Random832 are still arguing?

or, to put it simply, how about "if you write a python interpreter, you have implemented python" etc etc, if your name happens to be Guido van Rossum

There's Jython, IronPython, PyPy, and others. They are all python.

since "pass by reference", unlike python, is not a name that anyone has any special claim to, the bit about it mattering who you are to be able to say it can be omitted

They do something along those lines for C++, and that is exactly waht MIDL translates to when C or C++ is emitted when writing IDL-C++ for COM.

Jafet seems to disagree

well, I'm going shopping — hopefully random will work out the difference between emulating references and actually having them as part of the language.

What are you going shopping for?

You can _use_ something without there being special syntax in the language to support it

he's going to buy porn!

"Buy"?

Zhivago, ecchi…

That's so 1990.

you say "part of the language", i say "language has special syntax to support it" - I don't see the difference except mine is more clear

why? there are still "sex shops" out there..

still? burn them!

I don't own them

it's ok, burn them using a burning cross, nobody will say a thing.

I don't need to use special syntax to support this particular pattern, because the general syntax for pointers is reasonably compact perfectly adequate to the task

Sometimes that special syntax makes a big difference between something that is extremely hard to optimize (such as MASM), and something that is heavily optimized (such as C++ and Fortran)

*compact and perfectly
the ONLY reason asm can't be optimized is because of a "contract" that requires assemblers to provide verbatim output.

Also consider that std

*
To prove that you're not a bot, enter this code
Anti-Spam Image

Leave a Comment

You must be logged in to post a comment.


Blog Tags:

Similar posts: