- Problem with pointer semantics
----boundary-LibPST-iamunique-968295562_-_-
Content-type: text/plain
Thanks to all who replied. I think it's useful to summarize the comments and reply briefly.
1. The dereference operator ( b^ := a^ ) was suggested as a way of distinguishing between copying by value and copying by reference. Unfortunately, as long as "b:= a" is permitted, there is no guard against accidentally copying a pointer when a value copy was intended. Also, "b^:=a^" is not permitted by CP.
2. Explicit dereferencing ( b^[i] := 1 ) is permitted and it does clarify the code, but it likewise does not guard against unintentionally copying a pointer.
3. b := ALIAS(a) was suggested instead of ASSIGN(a (* to *) b) or b:= a. I like this, although I expect it will never happen.
4. I think everybody dislikes Hungarian notation. As used in C, my variables a and b would be something like psiaA and psiaB. But I simply use pA and pA to indicate pointers. Marc Martin uses aPtr and bPtr.
5. Some people argued fervently that they wanted pointer assignment, maybe with some justification. They have no worries, since removing it would require creating a subset language and breaking existing code. Two arguments were used: (1) the feature is too convenient to eliminate; and (2) real programmers don't need compiler checks. Ironically, these are the two arguments that are used against strong type checking. :-) Also ironically, the remedy (naming conventions) is the same.
6. There were two other comments that I could not read, and one that appeared to be empty.
Rex Couture
--- BlackBox
--- send subject HELP or UNSUBSCRIBE to blackbox{([at]})nowhere.xy
----boundary-LibPST-iamunique-968295562_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"
e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZnJvbXRleHQgXGRlZmYwe1xmb250dGJsDQp7XGYwXGZz
d2lzcyBBcmlhbDt9DQp7XGYxXGZtb2Rlcm4gQ291cmllciBOZXc7fQ0Ke1xmMlxmbmlsXGZjaGFy
c2V0MiBTeW1ib2w7fQ0Ke1xmM1xmbW9kZXJuXGZjaGFyc2V0MCBDb3VyaWVyIE5ldzt9fQ0Ke1xj
b2xvcnRibFxyZWQwXGdyZWVuMFxibHVlMDtccmVkMFxncmVlbjBcYmx1ZTI1NTt9DQpcdWMxXHBh
cmRccGxhaW5cZGVmdGFiMzYwIFxmMFxmczIwIFx0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QpccGFyDQotLS0gQmxhY2tCb3hccGFyDQotLS0gc2VuZCBzdWJqZWN0IEhF
TFAgb3IgVU5TVUJTQ1JJQkUgdG8gYmxhY2tib3hAb2Jlcm9uLmNofX0AZXJuaGGgAQAAGg==
----boundary-LibPST-iamunique-968295562_-_---
Received on Wed Jun 21 2006 - 00:05:14 UTC
This archive was generated by hypermail 2.3.0
: Thu Sep 26 2013 - 06:27:50 UTC