Re: [BLACKBOX] Order of calculating parameters

From: [at]} <Chris>
Date: Fri, 8 Feb 2013 07:02:08 +1030

----boundary-LibPST-iamunique-14238776_-_-
Content-type: text/plain

> -----Original Message-----
> From: BlackBox [mailto:BLACKBOX{([at]})nowhere.xy
> Sent: Friday, 8 February 2013 2:12 AM
> To: BLACKBOX{([at]})nowhere.xy
> Subject: [BLACKBOX] Order of calculating parameters
>
> Is the order of calculating parameters uniquely defined in standard of
> Component Pascal (or Oberon/Oberon-2)? I've this situation.
>
> PROCEDURE GetData (): INTEGER;
> BEGIN (* The data is taken from array "arr", indexed by var "idx". Order
> of taken data is one by one. *)
> INC(idx); RETURN arr[idx]
> END GetData;
>
> ...
> (* Example code: *)
> PutTile(GetData(), GetData(), GetData()); (* x, y, tile number *) ...
>

This is an good example of how *not* to use a procedure that has
side-effects.

See section 6.6.1 "Side-effects" in "Programming in Oberon" by Martin Reiser
and N Wirth:

"We emphasize that changes of global variables through side-effects of
functions is considered neither desirable practice nor good programming
style. Nevertheless, it is sometimes justified, as in the case of Uniform."
(Uniform is a rare good example which is given in the book).

Regards,

Chris Burrows
CFB Software
http://www.cfbsoftware.com


----
To unsubscribe, send a message with body "SIGNOFF BLACKBOX" to LISTSERV{([at]})nowhere.xy----boundary-LibPST-iamunique-14238776_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"
e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZnJvbXRleHQgXGZiaWRpcyBcZGVmZjB7XGZvbnR0YmwN
CntcZjBcZnN3aXNzIEFyaWFsO30NCntcZjFcZm1vZGVybiBDb3VyaWVyIE5ldzt9DQp7XGYyXGZu
aWxcZmNoYXJzZXQyIFN5bWJvbDt9DQp7XGYzXGZtb2Rlcm5cZmNoYXJzZXQwIENvdXJpZXIgTmV3
O319DQp7XGNvbG9ydGJsXHJlZDBcZ3JlZW4wXGJsdWUwO1xyZWQwXGdyZWVuMFxibHVlMjU1O30N
Clx1YzF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hcg0KPiBc
cGFyDQpccGFyDQpUaGlzIGlzIGFuIGdvb2QgZXhhbXBsZSBvZiBob3cgKm5vdCogdG8gdXNlIGEg
cHJvY2VkdXJlIHRoYXQgaGFzXHBhcg0Kc2lkZS1lZmZlY3RzLlxwYXINClxwYXINClNlZSBzZWN0
aW9uIDYuNi4xICJTaWRlLWVmZmVjdHMiIGluICJQcm9ncmFtbWluZyBpbiBPYmVyb24iIGJ5IE1h
cnRpbiBSZWlzZXJccGFyDQphbmQgTiBXaXJ0aDpccGFyDQpccGFyDQoiV2UgZW1waGFzaXplIHRo
YXQgY2hhbmdlcyBvZiBnbG9iYWwgdmFyaWFibGVzIHRocm91Z2ggc2lkZS1lZmZlY3RzIG9mXHBh
cg0KZnVuY3Rpb25zIGlzIGNvbnNpZGVyZWQgbmVpdGhlciBkZXNpcmFibGUgcHJhY3RpY2Ugbm9y
IGdvb2QgcHJvZ3JhbW1pbmdccGFyDQpzdHlsZS4gTmV2ZXJ0aGVsZXNzLCBpdCBpcyBzb21ldGlt
ZXMganVzdGlmaWVkLCBhcyBpbiB0aGUgY2FzZSBvZiBVbmlmb3JtLiJccGFyDQooVW5pZm9ybSBp
cyBhIHJhcmUgZ29vZCBleGFtcGxlIHdoaWNoIGlzIGdpdmVuIGluIHRoZSBib29rKS5ccGFyDQpc
cGFyDQpSZWdhcmRzLFxwYXINClxwYXINCkNocmlzIEJ1cnJvd3NccGFyDQpDRkIgU29mdHdhcmVc
cGFyDQpodHRwOi8vd3d3LmNmYnNvZnR3YXJlLmNvbVxwYXINClxwYXINClxwYXINCi0tLS1ccGFy
DQpUbyB1bnN1YnNjcmliZSwgc2VuZCBhIG1lc3NhZ2Ugd2l0aCBib2R5ICJTSUdOT0ZGIEJMQUNL
Qk9YIiB0byBMSVNUU0VSVkBMSVNUUy5PQkVST04uQ0hcfX0AAAAE
----boundary-LibPST-iamunique-14238776_-_---
Received on Thu Feb 07 2013 - 21:32:08 UTC

This archive was generated by hypermail 2.3.0 : Thu Sep 26 2013 - 06:29:54 UTC