[Tutor] Question about 'scopes' (fwd)

Danny Yoo dyoo@hkn.eecs.berkeley.edu
Mon Mar 24 17:27:14 2003


Hi Andy,

I will delegate to the main Tutor list --- I'm slightly busy at the
moment.  It's usually a good idea to do a 'Reply-to-All' so that the main
Tutor list is always part of the conversation.  This keeps any single
person (like me) from being a bottleneck toward your understanding.


I'll try to get back to your scope question this evening, but hopefully,
someone will get to you before then.  *grin* I'm sorry for the nonanswer!




---------- Forwarded message ----------
Date: Mon, 24 Mar 2003 21:00:45 +0000
From: ahimsa <ahimsa@onetel.net.uk>
To: Danny Yoo <dyoo@hkn.eecs.berkeley.edu>
Subject: Re: [Tutor] Question about 'scopes'

Thanx (once again) Danny

So the scope is, in effect, a boundary on what can and cannot be referenced
from within a given namespace?

On Monday 24 Mar 2003 7:56 pm, Danny Yoo wrote:
> Scope can be thought of as containment.  For example, the biological
> analogy to scope might be to a cell and its membrane.

> Let's abuse the analogy.  Variable names that are local to a function are
> like enzymes in a cell:  the cell membrane localizes the effect of enzymes
> so that they don't do random things to the whole system, but only within
> the context of the cell.  Likewise, the scope of a function limits the
> effects of variable names so that we don't effect change globally
> throughout the system.

> Some cells do allow controlled input and output through membrane channels,
> and these channels allow material to flow in and out of the cell in a
> controlled way.  In computer languages, the concept of a return value and
> input parameters allows us to control the flow of information in and out
> of a particular function.

> So it's possible to borrow many of the terms of biology and apply them
> inappropriately to programming.  *grin*

Any little bit of purchase on these concepts is worth having as far as I'm
concerned - once I am more comfortable and confident with CS-speak I'll be
quite happy to loosen my grip on the more concrete and familiar analogies!!!

Thanks

Andy



-- 
News from a diiferent perspective:
http://www.scoop.co.nz
http://www.fromthewilderness.com
____________________________
Prevent digital monopoly:
http://www.againsttcpa.com