On Mon, May 19, 2008 at 10:41 AM, David MacQuigg
<[EMAIL PROTECTED]> wrote:

<< SNIP >>

> I said earlier that we shouldn't raise this topic in a class for beginners, 
> but now I think it is quite appropriate for college freshmen.  I'm an 
> electrical engineer, not a computer scientist, but I do remember learning 
> about call-by-value/reference decades ago.  I think there is value in keeping 
> the definitions simple, even if modern languages don't conform.  Let's not 
> muddy the waters with "call by object" or other ill-defined concepts.  There 
> really are only two ways to pass an argument to a function - copy the value 
> or copy a reference.
>
> -- Dave

My view remains that "calling a function" is a subcategory of
"assignment" (aka "binding") more generally, as what happens in x = y
versus f ( x = y) or f (y) with x local to f, is not different in
principle.  The question is how one adds to a namespace, never mind
the scope changes.

Also, let's make sure C students appreciate the flexibility of being
able to have differently typed pointers sharing the same reference
(address).  Python has nothing exactly like it, given how type info
rests with the object.  In calling by reference, you're free to change
type of pointer, as well as scope (you can do this by simple
assignment as well).

I'm skeptical that K&R concepts should be applied de rigueur, no
matter what the intended paradigm, but it's certainly an interesting
exercise, and translators differ.

Kirby
_______________________________________________
Edu-sig mailing list
[email protected]
http://mail.python.org/mailman/listinfo/edu-sig

Reply via email to