Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
quest for pass-by-reference semantics in CL
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  Messages 201 - 225 of 252 - Collapse all  -  Translate all to Translated (View all originals) < Older  Newer >
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Erann Gat  
View profile  
 More options May 5 2002, 10:57 pm
Newsgroups: comp.lang.lisp
From: g...@jpl.nasa.gov (Erann Gat)
Date: Sun, 05 May 2002 19:16:09 -0700
Local: Sun, May 5 2002 10:16 pm
Subject: Re: quest for pass-by-reference semantics in CL
In article <vi4n0ve1s91....@blue.cs.yorku.ca>, ozan s yigit

I don't think your collection is typical.  I doubt one working programmer
in three has even one of those books, let alone all four.  The only one of
these that I own is EOPL, and in my copy, page 28 has no subject headings
at all.  Page 29 starts a section called "variable arity procedures."  (Is
there more than one edition?)  The "definition" of binding is given on
page 2.  (I put "definition" in scare quotes because it isn't really a
definition, just an example of canonical usage.)

E.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ozan s yigit  
View profile  
 More options May 5 2002, 11:15 pm
Newsgroups: comp.lang.lisp
From: ozan s yigit <o...@blue.cs.yorku.ca>
Date: 05 May 2002 23:03:38 -0400
Local: Sun, May 5 2002 11:03 pm
Subject: Re: quest for pass-by-reference semantics in CL
Bruce Hoult:

> One big obstacle, I think, is that at the time the terms "call by
> value", "call by reference", and "call by name" were invented, pretty
> much all variables in all languages were statically typed, of known and
> fixed size, and either statically allocated at absolute addresses or at
> a fixed offset from some base register.

this is just not true. please, please just go to any CS library and read
up. maybe just find a copy of allen: CBV and CBN are both covered nicely.

oz
---
the most underused tool in the kitchen is the brain. -- alton brown


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ozan s yigit  
View profile  
 More options May 6 2002, 12:00 am
Newsgroups: comp.lang.lisp
From: ozan s yigit <o...@blue.cs.yorku.ca>
Date: 05 May 2002 23:55:34 -0400
Local: Sun, May 5 2002 11:55 pm
Subject: Re: quest for pass-by-reference semantics in CL

g...@jpl.nasa.gov (Erann Gat) writes:
> I don't think your collection is typical.  I doubt one working programmer
> in three has even one of those books, let alone all four.

well, i'm not sure what you meant by published works, so i've picked
some general PL books, as per topic. that is what a working programmer
with any interest in PL terminology and technology would probably reach
for, not some IDIOT's* guide.

yes, there is a second edition of EOPL. the discussion there seems
pretty good to me, but it is not a dry dictionary definition.

oz
---
* note that not all IDIOT's guides are created equal: those interested
  in writing and publishing science fiction should find a copy of Cory
  Doctorow and Karl Schroeder's "the complete idiot's guide to publishing
  science fiction" and ignore any strange stares. it is simply one of the
  best books on the topic. Schroeder recently also published "ventus" and
  "permanence."


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Bruce Hoult  
View profile  
 More options May 6 2002, 12:05 am
Newsgroups: comp.lang.lisp
From: Bruce Hoult <br...@hoult.org>
Date: Mon, 06 May 2002 16:05:35 +1200
Local: Mon, May 6 2002 12:05 am
Subject: Re: quest for pass-by-reference semantics in CL
In article <871ycqvzd2....@charter.net>,
 Doug Quale <qua...@charter.net> wrote:

> Bruce Hoult <br...@hoult.org> writes:

> > One big obstacle, I think, is that at the time the terms "call by
> > value", "call by reference", and "call by name" were invented, pretty
> > much all variables in all languages were statically typed, of known and
> > fixed size, and either statically allocated at absolute addresses or at
> > a fixed offset from some base register.

> This is nonsense.  Lisp is the second oldest computer language still
> in common use and call-by-value, call-by-reference and call-by-name
> are decades old concepts and terms.  As Matthias Blume has already
> pointed out, people in and around the lisp community were those who
> initially developed these ideas and terminology.  Lisp was the
> canonical example of cbv and Algol-60 was (and still is) the canonical
> example of cbn.

You need to look outside the Lisp community.  Lisp is just *one*
programming language (or a small family), and historically a rather
poorly known one and not very influential outside its niche in academia.  
I certainly know its age, and I also know that the other major languages
of that time -- FORTRAN and COBOL are as I describe them.  So is Algol
60, for that matter.  Languages didn't change much until the Algol
68/C/Pascal era, and by that time the terminology was already well fixed.

> Typing issues are completely orthogonal to cbv parameter passing, and
> so are allocation and stack frame details.

No they are not.  When you know exact details of the type and lifetime
of values you can make significant optimizations over their allocation.  
Only extremely sophisticated Lisp compilers make these optimizations,
but in FORTRAN and COBOL (for example) these optimizations are not even
thought of as optimizations because the langauge specification defines
away the possibility of dynamic types and dynamic lifetimes.

> One big obstacle, I think, is the insular nature of the lisp
> community.

This I agree with.

-- Bruce


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Stephen J. Bevan  
View profile  
 More options May 6 2002, 2:34 am
Newsgroups: comp.lang.lisp
From: step...@dino.dnsalias.com (Stephen J. Bevan)
Date: Mon, 06 May 2002 06:34:22 GMT
Local: Mon, May 6 2002 2:34 am
Subject: Re: quest for pass-by-reference semantics in CL

"Coby Beck" <cb...@mercury.bc.ca> writes:
> When arguing about the correct name for something there are only two (often
> unresolvable) approaches:  argument by authority and argument by consensus.
> You aren't appealing to consensus but you have not provided any citations to
> support what you say, so it can not yet be convincing.

I haven't checked Matthias' definitions word for word but on first
reading they certainly seemed similar to my memory of the definitions
found in books on denotational semantics.  I checked the following
four to see that they do have sections on parameter passing that
describe (denotationally) what call by value, call by reference,
... etc. mean :-

@book
{ Stoy:ds:1977
, author=    "Joseph E. Stoy"
, title=     "Denotational Semantics: The Scott-Strachey Approach to
              Programming Language Theory"
, publisher= "MIT Press"
, isbn=      "0-262-69076-4"
, year=      1977
, refs=      70
, source=    "own"
, checked=   19971116
, reffrom=   Pepper:pc:1978
, reffrom=   tafdoa:1980
, reffrom=   Sethi:Tang:jacm:1980
, reffrom=   Ganzinger:sdcg:1980
, reffrom=   Jones:Schmidt:sdcg:1980
, reffrom=   Raskovsky:Collier:sdcg:1980
, reffrom=   Mosses:sdcg:1980
, reffrom=   Schmidt:sdcg:1980
, reffrom=   Donzeau-Couge:Kahn:Lang:sdcg:1980
, reffrom=   Aho:ieee:computer:1980
, reffrom=   Raskovsky:acm:cc:1982
, reffrom=   Sethi:acm:cc:1982
, reffrom=   Moss:acm:lfp:1982
, reffrom=   PeytonJones:acm:lfp:1982
, reffrom=   Clinger:acm:lfp:1982
, reffrom=   Cartwright:Donahue:acm:lfp:1982
, reffrom=   Wetherell:acm:toplas:1982
, reffrom=   Wand:acm:toplas:1982
, reffrom=   Cottam:ieee:tose:1984
, reffrom=   desRivieres:Smith:acm:lfp:1984
, reffrom=   Harland:poly:1984
, reffrom=   Hudak:Goldberg:fplca:1985
, reffrom=   Rees:Clinger:acm:sigplan:1986
, reffrom=   Bahlke:Snelting:acm:toplas:1986
, reffrom=   Allison:pids:1986
, reffrom=   Schmidt:ds:1986
, reffrom=   Garrison:phd:1987
, reffrom=   Goldberg:fplca:1987
, reffrom=   Shebs:Kessler:iait:1987
, reffrom=   ifpl:1987
, reffrom=   Wadler:Hughes:fplca:1987
, reffrom=   Felleisen:Wand:Friedman:Duba:acm:lfp:1988
, reffrom=   Meyer:Riecke:acm:lfp:1988
, reffrom=   Reddy:acm:lfp:1988
, reffrom=   Lamping:acm:lfp:1988
, reffrom=   Field:Harrison:fp:1988
, reffrom=   Jones:Sinclair:bcs:cj:1989
, reffrom=   McDonald:Allison:bcs:cj:1989
, reffrom=   Moritz:phd:1989
, reffrom=   PeytonJones:bcs:cj:1989
, reffrom=   Pierce:cmu:cs:113:1990
, reffrom=   Jian:Xu:acm:sigplan:1990
, reffrom=   Katz:Wise:acm:lfp:1990
, reffrom=   Queinnec:plilp:1990
, reffrom=   vanHorebeek:Lewi:acm:sigplan:1990
, reffrom=   Rosendahl:agata:1990
, reffrom=   Sondergaard:Sestoft:acta:1990
, reffrom=   Asperti:Longo:cts:1991
, reffrom=   Meijer:Fokkinga:Paterson:fplca:1991
, reffrom=   Swarup:Reddy:Ireland:fplca:1991
, reffrom=   Fradet:fplca:1991
, reffrom=   Hudak:Young:acm:toplas:1991
, reffrom=   Jagadeesan:Pingali:Panangaden:acm:toplas:1991
, reffrom=   Watt:plss:1991
, reffrom=   Queinnec:acm:lp:1992
, reffrom=   Fagan:phd:1992
, reffrom=   Tung:acm:lfp:1992
, reffrom=   Wand:Oliva:acm:lfp:1992
, reffrom=   Appel:cwc:1992
, reffrom=   Odersky:acm:toplas:1993
, reffrom=   Plasmeijer:vanEkelen:fpapgr:1993
, reffrom=   Jones:Gomard:Sestoft:peapg:1993
, reffrom=   Thompson:Hill:fple:1995
, reffrom=   Kirkerud:pls:1997
, reffrom=   Appel:mcij:1998

}

@book
{ Schmidt:ds:1986
, author=    "David A. Schmidt"
, title=     "Denotational Semantics - A Methodology for Language Development"
, publisher= "Allyn and Bacon"
, year=      "1986"
, cr=        "somewhere in jan-jun 1990"
, refs=      323
, source=    "own"
, checked=   19971230
, isbn=      "0-205-10450-9"
, reffrom=   Wadler:Hughes:fplca:1987
, reffrom=   Felleisen:Wand:Friedman:Duba:acm:lfp:1988
, reffrom=   Meyer:Riecke:acm:lfp:1988
, reffrom=   Danvy:Malmkjaer:acm:lfp:1988
, reffrom=   Consel:esop:1988
, reffrom=   Cartwright:Felleisen:acm:pldi:1989
, reffrom=   Jouvelot:Gifford:acm:pldi:1989
, reffrom=   Moritz:phd:1989
, reffrom=   Pierce:cmu:cs:113:1990
, reffrom=   Consel:acm:lfp:1990
, reffrom=   Davey:Priestly:ilo:1990
, reffrom=   Draghicescu:Purushothaman:acm:lfp:1990
, reffrom=   Queinnec:plilp:1990
, reffrom=   Rosendahl:agata:1990
, reffrom=   Waite:agata:1990
, reffrom=   Meijer:Fokkinga:Paterson:fplca:1991
, reffrom=   Fradet:fplca:1991
, reffrom=   PeytonJones:Launchbury:fplca:1991
, reffrom=   Hudak:Young:acm:toplas:1991
, reffrom=   Watt:plss:1991
, reffrom=   Kastens:Waite:acta:1991
, reffrom=   Fagan:phd:1992
, reffrom=   Muller:Zhou:acm:lfp:1992
, reffrom=   Wand:Oliva:acm:lfp:1992
, reffrom=   Lawall:Friedman:indiana:346:1992
, reffrom=   Appel:cwc:1992
, reffrom=   Jones:Gomard:Sestoft:peapg:1993
, reffrom=   Meijer:Hutton:fplca:1995
, reffrom=   Kirkerud:pls:1997
, reffrom=   Hutton:acm:icfp:1998

}

@book
{ Watt:plss:1991
, author=    "David A. Watt"
, title=     "Programming Language Syntax and Semantics"
, publisher= "Prentice-Hall"
, year=      1991
, refs=      58
, source=    "own"
, checked=   19960310
, isbn=      "0-13-726274-4"
, blurb=     "Programming Language Syntax and Semantics introduces
  methods for formaly specifying the syntax and semantics of programming
  languages.

  Chapter 2 introduces the topic of syntax, covering both context-free
  grammars and regular expressions.  Chapters 3-5 introduce denotational
  semantics, the most commonly used method for specifying semantics.
  Chapter 6 introduces algebraic semantics, applying it to specify new
  data types.  Chapters 7-8 introduce action semantics, a new method
  that promises to make semantic specifications unusually readable. the
  text concentrates on practical specification techniques, but the
  underlying theory is briefly covered where appropriate.

  Numerous examples, exercises, and case studies support the text."

}

@book
{ Kirkerud:pls:1997
, author=    "Bj{\/o}rd Kirkerud"
, title=     "Programming Language Semantics: Imperative and Object
Oriented Languages"
, publisher= "Thomson"
, year=      1997
, refs=      32
, pages=     347
, source=    "own"
, checked=   19970201
, cost=      "UKP 23.95"
, isbn=      "1-85032-273-2"
, blurb=     "{\em Programming Language Semantics} is designed to
  provide a formal introduction to the semantics of programming
  languages for readers with little or no prior experience of the
  subject.  Focusing mainly on denotational semantics, the author also
  explains operational and axiomatic semantics.

  The book explains how to define semantics of imperative programming
  languages.  A chapter on objects and clsses is also included,
  providing the formal definitions of the semantics of object oriented
  languages.  The functional language ML is used to implement some of
  the formal definitions given in the book."


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Takehiko Abe  
View profile  
 More options May 6 2002, 5:09 am
Newsgroups: comp.lang.lisp
From: k...@ma.ccom (Takehiko Abe)
Date: Mon, 06 May 2002 09:08:58 GMT
Local: Mon, May 6 2002 5:08 am
Subject: Re: quest for pass-by-reference semantics in CL

In article <3229595420030...@naggum.net>, Erik Naggum wrote:
> | I had read your previous post about 'the standard three' and I thought I
> | got them right. I have a mental model of Lisp's argument passing, which
> | seems very natural and intuitive. However, my understanding was that it's
> | different from C's argument possing model which involves 'copying' of an
> | argument.

>   Well, no, C's does not involve copying, it just passes all struct members
>   as individual arguments, as in destructuring.  I guess a destructured
>   pass by value looks a lot like a copy, and I guess this whole messy
>   argument passing thing in C has confused a lot of people, what with
>   arrays being passed by value but as references, with pointers being
>   passed by value but being references, and struct being passed by value
>   but as values.

These are what I wanted to know -- C's model. It's all clear now.
Thank you. I think the above and your summary of pass-by-XXXs would
make a good entry for a FAQ.

abe

--
"What we hear constantly is that after September 11th, everything changed.
There is a good rule of thumb: if something is repeated over and over as
obvious, the chances are that it is obviously false."       -- Chomsky
<http://www.zmag.org/content/ForeignPolicy/chomsky_march26.cfm>


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Erann Gat  
View profile  
 More options May 6 2002, 1:56 pm
Newsgroups: comp.lang.lisp
From: g...@jpl.nasa.gov (Erann Gat)
Date: Mon, 06 May 2002 10:04:46 -0700
Local: Mon, May 6 2002 1:04 pm
Subject: Re: quest for pass-by-reference semantics in CL

In article <3229606270797...@naggum.net>, Erik Naggum <e...@naggum.net> wrote:
> | They read K&R and Stroustrup or C++ for Dummies, and as a result they
> | have no idea what a binding is.  And it's not their fault.  It's very
> | hard to find a good definition of the word "binding" (as a noun) in
> | published works.  If you don't believe me, time yourself to see how long
> | it takes you to find one (not including the Hyperspec, of course).

>   H.P.Barendregt: The Lambda Calculus, Its Syntax and Semantics.  1 second.
>   (It is within reach from where I sit.)

Well, *there's* a book that's undoubtedly at ready hand to every working
programmer.

[Snip]

>   By this time, I had spent 20 minutes pulling some 30 books out of my
>   1100-volume strong personal library and had found 12 hot hits.  So not
>   only did I know roughly where to look, it was where I thought I would
>   find it.  If any the other books also have a description of binding, I do
>   not know, but I am not at all unhappy with the hit rate.

Are you arguing in support of my position or against it?  A hit rate of
one in three out of books hand-picked by an expert out of an extensive
personal library is the *best* one could hope to achieve.  The more
typical situation is probably closer to randomly browsing the computer
section at Barnes and Noble.

E.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Erann Gat  
View profile  
 More options May 6 2002, 1:56 pm
Newsgroups: comp.lang.lisp
From: g...@jpl.nasa.gov (Erann Gat)
Date: Mon, 06 May 2002 10:19:38 -0700
Local: Mon, May 6 2002 1:19 pm
Subject: Re: quest for pass-by-reference semantics in CL

In article <3229608336004...@naggum.net>, Erik Naggum <e...@naggum.net> wrote:
> * Erann Gat
> | Perhaps, but that still doesn't justify saying "It's call by value.
> | Period."  At best, "It's call by value, and all the values are pointers
> | that are automatically dereferenced every time you refer to them."  But
> | even that isn't entirely true because...

>   Please listen.  Call _by_ value is different from call _with_ value.

That's news to me.  I've never heard of this distinction before.  Could
you please cite a reference?

>   The
>   meaning of "value" is irrelevant.  The fact that you cannot access the
>   _binding_ of the value is the clue.  In call _by_ reference, you do not
>   pass _some_ references to objects, you pass references to _bindings_.

Yes, I understand that, but I think you've missed the point.  The point is
not whether Lisp is call-by-value or not.  I concede that it is.  The
point is that the apparent behavior of Lisp and C is different.  That
difference has to be accounted for somehow if you're going to try to teach
Lisp to C programmers.  There are various ways to account for this
difference.  Kent's approach is to invent a new story about argument
passing that he calls "call-by-identity".  Matthias's approach is to talk
about the underlying implementation of Lisp values as pointers.  And your
approach is (apparently) to focus on the distinction between values and
bindings.

My point is that none of these approaches is inherently superior to the
others, and that the standard by which they should be judged is how
effective they are in helping people understand.  My personal intuition is
that Kent's approach seems most promising on this metric, but the only way
to resolve the issue is to do some actual experiments with actual C
programmers.

E.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Erann Gat  
View profile  
 More options May 6 2002, 1:57 pm
Newsgroups: comp.lang.lisp
From: g...@jpl.nasa.gov (Erann Gat)
Date: Mon, 06 May 2002 10:30:52 -0700
Local: Mon, May 6 2002 1:30 pm
Subject: Re: quest for pass-by-reference semantics in CL
In article <bruce-0E6C86.12260006052...@copper.ipg.tsnz.net>, Bruce Hoult

<br...@hoult.org> wrote:
> I'm convinced it's more a terminology problem than an actual
> understanding problem.

I don't think you can separate the two.

> Yes, Lisp arguments are "call by value", but that is not at all enough
> to understand them because all the values are pointers (which Lisp calls
> "bindings") and the things that Lisp calls "values" are the heap objects
> pointed to by those pointers.

This is a perfect illustration of how terminology problems *are*
understanding problems.  Your definition of binding here...

> values are pointers (which Lisp calls "bindings")

is at odds with the definition given in the Hyperspec:

> binding n. an association between a name and that which the name denotes.

Your definition also contains a "type mismatch" error: pointers are
first-class entities.  Bindings are not.

E.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Erik Naggum  
View profile  
 More options May 6 2002, 5:23 pm
Newsgroups: comp.lang.lisp
From: Erik Naggum <e...@naggum.net>
Date: Mon, 06 May 2002 21:23:34 GMT
Local: Mon, May 6 2002 5:23 pm
Subject: Re: quest for pass-by-reference semantics in CL
* Erik Naggum

> H.P.Barendregt: The Lambda Calculus, Its Syntax and Semantics.  1 second.
> (It is within reach from where I sit.)

* Erann Gat
| Well, *there's* a book that's undoubtedly at ready hand to every working
| programmer.

  I sense hostility even when I try to answer your questions seriously.

  The only book I have within reach that is for a working programmer is the
  first edition of "ML for the Working Programmer", but I ignored that book
  because MLS is not for the working programmer.  You obviously have such
  an exclusive definition of "working programmer" that it is impossible to
  refute your claim by actually finding a commonly available book with a
  good definition.  This speaks volumes about the sincerity of your claim.

| Are you arguing in support of my position or against it?

  Again, I sense hostility even when I try to answer your questions
  seriously.  What do you think this tells me?

| A hit rate of one in three out of books hand-picked by an expert out of
| an extensive personal library is the *best* one could hope to achieve.

  Well, you have chosen a fairly technical term.  Her's another obvious
  answer to those in the pharmaceutical industry and quite a number of
  concerned users: In which common househould products would you find
  hexachlorophene, and if you know that it also the active ingredient in
  medication administered orally to cats, what is the ailment for which it
  is the therapy?  Where would you start looking?  There is _one_ reference
  work that a self-respecting physician or pharmacologist should have ready
  access to that answers this question.  Which is it?

| The more typical situation is probably closer to randomly browsing the
| computer section at Barnes and Noble.

  Do engineers who need to know the tensile strength of a steel quality go
  to Barnes & Noble?  My question here is really: Why is a computer
  programmer expected to be an illiterate fool and why are you basing your
  entire argument on the ignorance of the common programmer?  And this
  after "blaming" Matthias Blume for not writing textbooks for these
  people, when they would clearly not even touch it if it were for sale?

  Are programmers responsible for their own skills?  That is what this
  silly book hunt really boils down to.  Your answer is a resounding No.
  Mine is an equally resounding Yes.
--
  In a fight against something, the fight has value, victory has none.
  In a fight for something, the fight is a loss, victory merely relief.

  70 percent of American adults do not understand the scientific process.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Erik Naggum  
View profile  
 More options May 6 2002, 5:31 pm
Newsgroups: comp.lang.lisp
From: Erik Naggum <e...@naggum.net>
Date: Mon, 06 May 2002 21:31:24 GMT
Local: Mon, May 6 2002 5:31 pm
Subject: Re: quest for pass-by-reference semantics in CL
* Erann Gat
| That's news to me.  I've never heard of this distinction before.  Could
| you please cite a reference?

  It was intended to make you think.  It did not work this time, either.
  I am sorry that you need somebody else to tell you the same thing I do
  before you can muster the brainpower to think about something.  Your
  curious selectivity in asking for references is quite telling.  It is a
  sort of passive-aggressive behavior that I associate with cowards who
  think they can get away with their not-so-veiled hostilities.

| Kent's approach is to invent a new story about argument passing that he
| calls "call-by-identity".

  Did he provide any references for this novel term?  Why do you ask for
  references as a means of terrorizing people into silence when it is so
  obvious that you are being a hostile prick even when people try to deal
  with you as the intelligent being you once were and actually try to
  answer your mostly retarded questions seriously?

  Geez, I keep making the mistake of believing you will recover, somehow.
--
  In a fight against something, the fight has value, victory has none.
  In a fight for something, the fight is a loss, victory merely relief.

  70 percent of American adults do not understand the scientific process.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Bruce Hoult  
View profile  
 More options May 6 2002, 7:23 pm
Newsgroups: comp.lang.lisp
From: Bruce Hoult <br...@hoult.org>
Date: Tue, 07 May 2002 11:23:26 +1200
Local: Mon, May 6 2002 7:23 pm
Subject: Re: quest for pass-by-reference semantics in CL
In article <gat-0605021030520...@k-137-79-50-101.jpl.nasa.gov>,
 g...@jpl.nasa.gov (Erann Gat) wrote:

> In article <bruce-0E6C86.12260006052...@copper.ipg.tsnz.net>, Bruce Hoult
> <br...@hoult.org> wrote:

> > Yes, Lisp arguments are "call by value", but that is not at all enough
> > to understand them because all the values are pointers (which Lisp calls
> > "bindings") and the things that Lisp calls "values" are the heap objects
> > pointed to by those pointers.

> This is a perfect illustration of how terminology problems *are*
> understanding problems.

You're implying that I don't understand Lisp bindings and values?  That
would be a very strange thing if true, since I'm a member of the core
team working on a Lisp-family compiler.

> Your definition of binding here...

> > values are pointers (which Lisp calls "bindings")

> is at odds with the definition given in the Hyperspec:

> > binding n. an association between a name and that which the name denotes.

In fact I specifically coined that definition to match that section of
the HyperSpec.

> Your definition also contains a "type mismatch" error: pointers are
> first-class entities.  Bindings are not.

The term "first class" is relevent only to things that are defined in
the Lisp language.  "Pointers" in fact do not exist in the Lisp language
at all, they are merely an artifact of typical implementations.  
Bindings in the source code are translated into machine code in one of
two ways: by optimizing them away entirely, or by representing them as
machine pointers.

-- Bruce


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Joe Marshall  
View profile  
 More options May 6 2002, 9:18 pm
Newsgroups: comp.lang.lisp
From: prunesqual...@attbi.com (Joe Marshall)
Date: 6 May 2002 18:18:36 -0700
Local: Mon, May 6 2002 9:18 pm
Subject: Re: quest for pass-by-reference semantics in CL
Sorry for the delay, my newsfeed seems to be dead.

Jon Allen Boone <ipmon...@delamancha.org> wrote in message <news:m3offueo4k.fsf@validus.delamancha.org>...

Good question.  In every Common Lisp implementation I have seen,
the value is *always* a long-word.  (Acutally, I've seen a couple
that used two long-words.)  This is so that you can have
runtime polymorphism.  Since any value can be placed in any variable,
all values have to be the same size.

So in Lisp, X is guaranteed to fit in a long-word.

In C if the type of X is bigger than a long-word, you will have
more memory moving going on.  If it is less, you *might* have less,
or it could have been `expanded' to a long-word.

>     The second question is how does the last LEA instruction work to
>   compute the address?  Is this an x86 architecture?

Yes, it is x86, but I've seen LEA on other (non-RISC) architectures.
It works by causing the address computation hardware to compute the
address, but rather than putting the result on the bus, it puts it
in a register.  It's basically an adder, but since it knows about
word sizes, it can shift one of the addends by one or two bits.

Some people have noticed that you can use it as an adder for
extra performance because it doesn't use the same datapaths as the
ALU.  You can squeeze an extra addition through the pipeline if
you are clever.  (Or desperate, or have too much time on your hands.)


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Joe Marshall  
View profile  
 More options May 6 2002, 9:24 pm
Newsgroups: comp.lang.lisp
From: prunesqual...@attbi.com (Joe Marshall)
Date: 6 May 2002 18:24:12 -0700
Local: Mon, May 6 2002 9:24 pm
Subject: Re: quest for pass-by-reference semantics in CL

What I mean is this:  The value cell of the symbol X is somewhere
in memory.  Let's say it is at location 100.  The variable Y doesn't
need a symbol associated with it, so it's value is going to be on
the stack, say location 5000.

In the value cell of X, there is a 32-bit word.  It is likely a
pointer to something, but it doesn't matter.

Now when we call F, we read the 32-bit word out of location 100
and copy it into location 5000.  It is *this* copy that makes the
call `call-by-value'.

Our other option would be to put the number 100 into location 5000.
Then Y would not have a copy of X, but the address of X.  This
would be call-by-reference.

> > When F is running, there are two variables of
> > interest, x and y.  Both contain the same thing, yet they are not
> > the same location.

> This is where I lost track. I think they hold the same location.

If X contains an address, then after the copy, Y contains the
address, too.  If X *doesn't* contain an address, then Y won't
either.  What the 32-bits ultimately mean is unimportant.  What
is important is whether Y gets loaded with the same thing that
is in X (call-by-value), or whether Y gets loaded with the
address of X (call-by-reference).

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Erann Gat  
View profile  
 More options May 6 2002, 9:58 pm
Newsgroups: comp.lang.lisp
From: g...@jpl.nasa.gov (Erann Gat)
Date: Mon, 06 May 2002 18:51:20 -0700
Local: Mon, May 6 2002 9:51 pm
Subject: Re: quest for pass-by-reference semantics in CL
In article <bruce-65C62C.11232607052...@copper.ipg.tsnz.net>, Bruce Hoult

I wasn't intending to cast any aspersions on your professional
qualifications.  I was just responding to your earlier comment:

> I'm convinced it's more a terminology problem than an actual
> understanding problem.

The emphasis should be on "terminological problems *are* understanding
problems", not so much on the particular example.

Also, there are different kinds of understanding.  The kind of
understanding you need to get something done is different from the kind of
understanding you need to communicate your understanding to someone else.
(See Richard Feynman's writings on science education.)  The topic at hand
here is more the second kind of understanding.

> > Your definition of binding here...

> > > values are pointers (which Lisp calls "bindings")

> > is at odds with the definition given in the Hyperspec:

> > > binding n. an association between a name and that which the name denotes.

> In fact I specifically coined that definition to match that section of
> the HyperSpec.

Well, then I'm confused.  You say that values==pointers==bindings.  But in
the Hyperspec values!=bindings.

> > Your definition also contains a "type mismatch" error: pointers are
> > first-class entities.  Bindings are not.

> The term "first class" is relevent only to things that are defined in
> the Lisp language.  "Pointers" in fact do not exist in the Lisp language
> at all, they are merely an artifact of typical implementations.  
> Bindings in the source code are translated into machine code in one of
> two ways: by optimizing them away entirely, or by representing them as
> machine pointers.

OK, I think I understand.  So now we have *three* theories of how Lisp
arguments work.  (And all of them are right!)

E.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Bruce Hoult  
View profile  
 More options May 6 2002, 10:19 pm
Newsgroups: comp.lang.lisp
From: Bruce Hoult <br...@hoult.org>
Date: Tue, 07 May 2002 14:19:27 +1200
Local: Mon, May 6 2002 10:19 pm
Subject: Re: quest for pass-by-reference semantics in CL
In article <gat-0605021852040...@192.168.1.50>,
 g...@jpl.nasa.gov (Erann Gat) wrote:

> Well, then I'm confused.  You say that values==pointers==bindings.  But in
> the Hyperspec values!=bindings.

Well, no, I don't say that.

What I'm saying is (among other things) that if Lisp is "call by value"
(which I agree that it is, in the sense meant by the people who invented
the term) then the "values" being referred to are *not* the same as what
Lisp documentation calls "values".  They are, rather, what Lisp
documentation calls "bindings", where bindings are an indirect mechanism
used to refer to the values.

-- Bruce


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Erik Naggum  
View profile  
 More options May 6 2002, 10:50 pm
Newsgroups: comp.lang.lisp
From: Erik Naggum <e...@naggum.net>
Date: Tue, 07 May 2002 02:49:52 GMT
Local: Mon, May 6 2002 10:49 pm
Subject: Re: quest for pass-by-reference semantics in CL
* Bruce Hoult -> Erann Gat
| You're implying that I don't understand Lisp bindings and values?

  I am not satisfied to imply it: You demonstrate a serious lack of
  understanding of several such core issues.  This is quite amazing.

| That would be a very strange thing if true, since I'm a member of the
| core team working on a Lisp-family compiler.

  Gee.  How tragic.  But strange?  No.  Using such "credentials" to prove
  that you have understood something is also quite amazingly ridiculous.
--
  In a fight against something, the fight has value, victory has none.
  In a fight for something, the fight is a loss, victory merely relief.

  70 percent of American adults do not understand the scientific process.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Steven Shaw  
View profile  
 More options May 7 2002, 4:02 am
Newsgroups: comp.lang.lisp
From: steven_s...@users.sf.net (Steven Shaw)
Date: 7 May 2002 01:02:08 -0700
Local: Tues, May 7 2002 4:02 am
Subject: Re: quest for pass-by-reference semantics in CL
ozan s yigit <o...@blue.cs.yorku.ca> wrote in message <news:vi4vga5f8m6.fsf@blue.cs.yorku.ca>...

> this is an implementation detail. i don't believe either C standards
> specify what to do to preserve pass-by-value semantics. both just
> specify the semantic. moreover, if the compiler can tell that no
> assigments are made to the structure, it is under no oblication
> to make a copy.

The compiler has to be careful to follow the ABI (for the architecture
it's compiling to) - so as not to break separate compilation.
However, the optimisation you mention can be applied to static functions.

Further to the discussion: recall that both C and Lisp are call-by-value.
In C, if you want to modify a parameter (in the caller), you pass it's
address. This gets you call-by-reference semantics but it's
still call-by-value. You have to realise that, in this case, it is
the _address_ that is passed by value.

The same applies to Lisp. In not very clear on CL but I think that
the value contained in a variable is always an address (as in Python).

Steve.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Rahul Jain  
View profile  
 More options May 7 2002, 5:00 am
Newsgroups: comp.lang.lisp
From: Rahul Jain <ra...@rice.edu>
Date: 07 May 2002 03:51:08 -0500
Local: Tues, May 7 2002 4:51 am
Subject: Re: quest for pass-by-reference semantics in CL

steven_s...@users.sf.net (Steven Shaw) writes:
> The same applies to Lisp. In not very clear on CL but I think that
> the value contained in a variable is always an address (as in Python).

No, as in C, in Lisp, a lexical variable may be compiled away to a
register that can even be reserved for that variable only through part
of its scope or be in code that is completely removed or transformed,
and so, not exist at all in the compiled code.

I don't know what you mean by "as in Python". The python compiler does
some very intricate optimizations and elides unused code. If you mean
python-the-language, I have no idea what you're getting at.

--
-> -/                        - Rahul Jain -                        \- <-
-> -\  http://linux.rice.edu/~rahul -=-  mailto:rj...@techie.com   /- <-
-> -/ "Structure is nothing if it is all you got. Skeletons spook  \- <-
-> -\  people if [they] try to walk around on their own. I really  /- <-
-> -/  wonder why XML does not." -- Erik Naggum, comp.lang.lisp    \- <-
|--|--------|--------------|----|-------------|------|---------|-----|-|
   (c)1996-2002, All rights reserved. Disclaimer available upon request.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Duane Rettig  
View profile  
 More options May 7 2002, 5:01 am
Newsgroups: comp.lang.lisp
From: Duane Rettig <du...@franz.com>
Date: Tue, 07 May 2002 09:00:01 GMT
Local: Tues, May 7 2002 5:00 am
Subject: Re: quest for pass-by-reference semantics in CL

steven_s...@users.sf.net (Steven Shaw) writes:
> The same applies to Lisp. In not very clear on CL but I think that
> the value contained in a variable is always an address (as in Python).

Not true.  Consider fixnums and characters, as represented on most
current CL implementations.

--
Duane Rettig          Franz Inc.            http://www.franz.com/ (www)
1995 University Ave Suite 275  Berkeley, CA 94704
Phone: (510) 548-3600; FAX: (510) 548-8253   du...@Franz.COM (internet)


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Bruce Hoult  
View profile  
 More options May 7 2002, 6:17 am
Newsgroups: comp.lang.lisp
From: Bruce Hoult <br...@hoult.org>
Date: Tue, 07 May 2002 22:17:55 +1200
Local: Tues, May 7 2002 6:17 am
Subject: Re: quest for pass-by-reference semantics in CL
In article <4n0vc1hs8....@beta.franz.com>,
 Duane Rettig <du...@franz.com> wrote:

> steven_s...@users.sf.net (Steven Shaw) writes:

> > The same applies to Lisp. In not very clear on CL but I think that
> > the value contained in a variable is always an address (as in Python).

> Not true.  Consider fixnums and characters, as represented on most
> current CL implementations.

That's just a performance optimization (hack).  The results must be the
same AS IF the number or character was stored on the heap and the
variable contained a pointer.  Which turns out to be easy to do, since
fixnums and characters are immutable.

-- Bruce


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Bruce Hoult  
View profile  
 More options May 7 2002, 6:19 am
Newsgroups: comp.lang.lisp
From: Bruce Hoult <br...@hoult.org>
Date: Tue, 07 May 2002 22:19:32 +1200
Local: Tues, May 7 2002 6:19 am
Subject: Re: quest for pass-by-reference semantics in CL
In article <871yconxxf....@photino.sid.rice.edu>,
 Rahul Jain <ra...@rice.edu> wrote:

> steven_s...@users.sf.net (Steven Shaw) writes:

> > The same applies to Lisp. In not very clear on CL but I think that
> > the value contained in a variable is always an address (as in Python).

> No, as in C, in Lisp, a lexical variable may be compiled away to a
> register that can even be reserved for that variable only through part
> of its scope or be in code that is completely removed or transformed,
> and so, not exist at all in the compiled code.

Which, once again, are optimizations that are only valid so long as they
do not change the results.

-- Bruce


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Takehiko Abe  
View profile  
 More options May 7 2002, 8:37 am
Newsgroups: comp.lang.lisp
From: k...@ma.ccom (Takehiko Abe)
Date: Tue, 07 May 2002 12:37:23 GMT
Local: Tues, May 7 2002 8:37 am
Subject: Re: quest for pass-by-reference semantics in CL
In article <5bb0e1b2.0205061724.1113d...@posting.google.com>, prunesqual...@attbi.com (Joe Marshall) wrote:

> > > > > then f receives a copy of the contents of x.

> > > > No, it doesn't. f receives the contents of x, not a copy of it.
> > > > If that <something> is mutable, you can modifiy it in f.

> > > If F did not receive a copy of the contents of x, then it wouldn't
> > > be in X anymore.

> > My understanding is that F receives the location of the contents, so
> > both X and Y can share it.

> What I mean is this:  

What you meant by "..., then it wouldn't be in x anymore." ?

> [...]
> Now when we call F, we read the 32-bit word out of location 100
> and copy it into location 5000.  It is *this* copy that makes the
> call `call-by-value'.

*That* copy is irrelevant. We were talking about "the contents
of x". The contents of x is a Lisp object, and it is not copied.

--
"What we hear constantly is that after September 11th, everything changed.
There is a good rule of thumb: if something is repeated over and over as
obvious, the chances are that it is obviously false."       -- Chomsky
<http://www.zmag.org/content/ForeignPolicy/chomsky_march26.cfm>


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Duane Rettig  
View profile  
 More options May 7 2002, 11:01 am
Newsgroups: comp.lang.lisp
From: Duane Rettig <du...@franz.com>
Date: Tue, 07 May 2002 15:00:02 GMT
Local: Tues, May 7 2002 11:00 am
Subject: Re: quest for pass-by-reference semantics in CL

This does not change the fact that it is wrong to talk about values
always being addresses in CL when dealing with argument passing; it
is this mixture of semantics and implementation that causes so much
confusion:

 1. If you are talking about semantics, it is wrong because addresses
are not addressed :-) in CL semantics.

 2. If you are talking about implementation, it is wrong because values
are not _always_ implemented as addresses.

If you try to mix the two, you will cause confusion.

--
Duane Rettig          Franz Inc.            http://www.franz.com/ (www)
1995 University Ave Suite 275  Berkeley, CA 94704
Phone: (510) 548-3600; FAX: (510) 548-8253   du...@Franz.COM (internet)


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Geoff Summerhayes  
View profile  
 More options May 7 2002, 11:13 am
Newsgroups: comp.lang.lisp
From: "Geoff Summerhayes" <sNuOmSrPnA...@hNoOtSmPaAiMl.com>
Date: Tue, 07 May 2002 15:13:32 GMT
Local: Tues, May 7 2002 11:13 am
Subject: Re: quest for pass-by-reference semantics in CL

"Bruce Hoult" <br...@hoult.org> wrote in message

news:bruce-3F6508.22175507052002@copper.ipg.tsnz.net...

I don't think this model is a good idea since Lisp has no concept of
pointers as such. To make this work, it needs to be extended to all
symbols. i.e.

(defun foo(x) (+ x 3))

(defun main() (let ((x 4)) (setf x (foo x))))

struct LispVar
{
    enum LispType lt;
    void *var;

};

struct LispVar *foo(struct LispVar *x)
{
    struct LispVar *result=NULL;
    switch(x->lt)
    {
    case lt_FixNum:
        result=malloc(sizeof(struct LispVar));
        result->lt=lt_FixNum;
        result->var=malloc(sizeof(long));
        *((long *)result->var)=*((long *)x->var)+3;
        break;

          .
          .
          .

    default:
        SignalTypeError(x,lt_Number);
        break;
    }
    return result;

}

int main()
{
    struct LispVar *x,*temp;
    x=malloc(sizeof(struct LispVar));
    x->lt=lt_FixNum;
    x->var=malloc(sizeof(long));
    *((long *)x->var)=4;
    temp=foo(x);
    if(temp!=NULL)
    {
        free(x->var);
        free(x)
        x=temp;
    }

}

And the C *still* isn't a correct reflection (not particularly safe either).

C and Lisp have different conceptual models, it's not suprising trying to talk
about one in terms of the other leads to so much confusion. Of course, as
mentioned in other posts, if C structs were passed the way C arrays were there
would be less of a problem.

Forget implementation details, when you pass something in Lisp you pass the
actual
value, not a copy, not the slot that contains it. You cannot change what has
been
passed, you can't make a 3 into a 4 or a cons cell into an array. You cannot
change what the caller's variable contains since you don't have access to that
slot. You do have access to any slots that the actual value contains and any
changes are reflected up.

C and Lisp both use pass-by-value only C does a pass-by-copy-of-value and
Lisp does a pass-by-actual-value. Referring to Lisp as pass-by-reference
is just plain wrong and pass-by-value isn't enough to cover the difference
between Lisp and other languages, would anyone settle for calling the
differences subcategories of call-by-value?

---------------
Geoff


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Messages 201 - 225 of 252 < Older  Newer >
« Back to Discussions « Newer topic     Older topic »