Related articles |
---|
[13 earlier articles] |
Re: Pronouns in programming language? cbrtjr@ix.netcom.com (Charles E. Bortle, Jr.) (2000-03-06) |
Re: Pronouns in programming language? mal@bewoner.dma.be (Lieven Marchand) (2000-03-06) |
Re: Pronouns in programming language? carles.blas@uab.es (Carles Blas Anglada) (2000-03-06) |
Re: Pronouns in programming language? zorn@microsoft.com (Ben Zorn) (2000-03-06) |
Re: Pronouns in programming language? nr@labrador.eecs.harvard.edu (2000-03-06) |
Re: Pronouns in programming language? neitzel@gaertner.de (2000-03-06) |
Re: Pronouns in programming language? joachim.durchholz@halstenbach.com.or.de (Joachim Durchholz) (2000-03-06) |
Re: Pronouns in programming language? ralph@inputplus.demon.co.uk (2000-03-11) |
Re: Pronouns in programming language? genew@shuswap.net (2000-03-21) |
From: | "Joachim Durchholz" <joachim.durchholz@halstenbach.com.or.de> |
Newsgroups: | comp.compilers |
Date: | 6 Mar 2000 23:48:36 -0500 |
Organization: | Compilers Central |
References: | 00-02-149 00-03-019 |
Keywords: | design |
Carles Blas Anglada <carles.blas@uab.es> schrieb in im Newsbeitrag:
> In your example there is an elegant
> construction that answers that question: switch.
>
> switch (variable_with_long_name)
> case 2: do_this; break;
> case 3: do_that;
Pascal has
with <some path expression that returns a struct lvalue> do
begin
<some statements where struct members can be
accessed without repeating the above path expression>
end
BTW this is related to variable binding with call-by-reference
parameters:
procedure do_something (var foo: whatever)
(* People with a C background, assume 'whatever *foo'. *)
begin
...
end
do_something (some-exceedingly-long-path-expression)
Call-by-reference is probably the reason why most languages don't have
pronouns. Call-by-reference is much less dependent on context, i.e.
rearranging statements or even nesting doesn't inadvertently affect the
meaning of a call-by-reference parameter, while the mechanisms listed so
far in this group are all sensitive to such changes. Of course, if you
write a procedure just to get rid of some exceedingly long path name,
you there's a syntactic overhead to pay, and more than what the other
mechanisms require.
Regards,
Joachim
Return to the
comp.compilers page.
Search the
comp.compilers archives again.