Re: How to update an agrument passed by name in scheme



Matthias Blume wrote:
In particular, your description neither matches an intuitive notion of
what a pair is -- i.e. a value with an external representation such as
(1 . 2) -- nor does it match way the R5RS semantics is presented.


This is a really bad intuition that you have there. It certainly is
not my intuition of what a Scheme pair is.

Note that I said "an" intuition, not the only possible or useful one.

So, what would you call the thing in Scheme with an external representation of the form (x . y) ?

The description is also a bit convoluted.


Well, the semantics of Scheme pairs is a bit convoluted. How exactly
would you de-convolve my description in such a way that it stays
correct.

I'll answer that after you've responded on the question I posed in another message, re the descriptions used in the Java context, since that'll give me a better idea of your perspective.

All in all, I don't think it's a very good introductory treatment.


I don't care. I was not trying to give an introductory treatment. I
was givin a *correct* treatment. So-called introductory treatments
that are fundamentally incorrect in the sense that they use standard
terminology in a way that does not match their standard meaning (here:
"call by reference") is ultimately more confusing than any correct
treatment.

I didn't use the term "call by reference". However, I've discovered that any use of the two words "by" and "reference" consecutively in the same sentence trigger a rewrite rule in your brain. I'll keep that in mind. ;)

First, even if you think that your treatment makes sense in an "informal"
way, it still would not give you, however informally, that Scheme uses
call-by-reference for pairs. Call-by-reference implies that when I
write down a variable name x as an actual CBR argument, then an
assignment by the callee to the corresponding formal parameter will be
reflected by a change of the value stored in x. This does not happen
in Scheme, not with pairs, not with vectors, not with anything.

I have not written anywhere that "Scheme uses call-by-reference for pairs". I'm not claiming that, and have never been.

However, I've used language which I admit is probably too confusingly similar to "call by reference". This has apparently led you to believe that I'm saying something else. I thought you were objecting to the way I used the language, but you now seem to be misunderstanding me.

Someone else has already pointed this out to you (although you didn't
seem to "get" it and, instead, explained what we all already know,
namely how the callee can alter the contents of locations that are
part of the argument value.)

You're thinking of the explanation I gave of how I intended the phrase "passing a *value* by reference" to be understood (which, as I've mentioned, is quite similar to various common informal usages). I wasn't trying to explain what you already know, I was trying to relate what you already know to what I was saying. Apparently unsuccessfully.

And second, your "informal" notion of a value is just plain wrong.
"Value" also has a very specific technical meaning in the context of
programming language semantics. Using anything else leads to
confusion -- precisely the kind of confusion that we are seeing here.

As I mentioned in my reply to Brad Lucier, there's more to programs than formal semantics. If you really want a term that you can use with no possibility of application in other contexts, it's going to have to be something other than "value", since that's already pretty overloaded.

So, when trying to communicate a concept on Usenet, descriptions that
derive from formal semantics aren't always ideal.


Maybe. But they are definitely better than incorrect ones.

Sure. In this case, though, we're really arguing over things like whether the word "by" can be used in a certain way.

Anton
.



Relevant Pages

  • Re: How to update an agrument passed by name in scheme
    ... people say "say how much easier it is to do this thing in Scheme as opposed to whatever other language". ... But passing by reference is exceptionally easy in some of those other languages, and not so easy in Scheme, which, based on this thread, cannot be done trivially. ... that foo is an ordinary procedure, then without even knowing what foo does, we can safely conclude that the result of the expression is 5. ...
    (comp.lang.scheme)
  • Re: arrays = pointers?
    ... If it turns out that the memory scheme used by .NET is less efficient than other possible schemes, well...let's just say that wouldn't be the first time some major blunder was made when creating some computer architecture. ... If something is referenced only once or twice, then it doesn't matter how long it takes to resolve that reference. ... And it would require the compiler to do more work. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: How to update an agrument passed by name in scheme
    ... Scheme, which, based on this thread, cannot be done trivially. ... passed by reference in Scheme. ... What the OP meant by "passed by name" can also be described as "passing a variable by reference". ... In Algol 60, the problem was that the language had side effects, which don't mix well with call by name. ...
    (comp.lang.scheme)
  • Re: ((car (+ *)) 2 3) dont work
    ... it's an error to apply a nonprocedure and it's up to the ... So, it is not only me who is confused on this point, but Scheme ... Sorry for the confusion. ... The first element of a form must be a syntactic keyword, ...
    (comp.lang.scheme)
  • Re: How to update an agrument passed by name in scheme
    ... Scheme, which, based on this thread, cannot be done trivially. ... passed by reference in Scheme. ... In languages that have first-class references (like ... same effect by passing such a first-class reference value. ...
    (comp.lang.scheme)