Re: [BLACKBOX] BlackBox 1.6 final version? - Complex numbers

From: [at]} <Chris>
Date: Wed, 1 Jul 2009 16:54:44 +0930

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

 >-----Original Message-----
>From: BlackBox [mailto:BLACKBOX{([at]})nowhere.xy
>Sent: Wednesday, 1 July 2009 6:17 AM
>To: BLACKBOX{([at]})nowhere.xy
>Subject: Re: [BLACKBOX] BlackBox 1.6 final version? - Complex numbers
...
...
>
>(*If*) one chose to implement Complex as a RECORD type, and to
>have Complex functions, one would need to allow PROCEDUREs to
>return RECORDs, which Component Pascal does not support (but
>some Oberons do ?).
>
>Is there a simple explanation why this restriction is a good
>(or bad) idea?
>

While the restriction is generally a good idea it becomes a bad idea when
considering facilities (like COMPLEX functions) which allow general
operations / expressions involving structured types. This is presumably why
'Structured Return Values' were added to OberonX at the same time as
user-defined operators.

"OberonX allows procedures to return any type. This should allow a better
abstraction in the language and help in the implementation of mathematical
code, making the use of functional code much simpler."

http://www-old.oberon.ethz.ch/native/compiler/x.return.html

Also, there's a section dealing with the topic of structured function
results in Niklaus Wirth's Compiler Construction book:

"12.6. Function procedures

A function procedure is a procedure whose identifier simultaneously denotes
both an algorithm and its result. It is activated not by a call statement
but by a factor of an expression. The call of a function procedure must
therefore also take care of returning the function's result. The question
therefore arises of which resources should be used.

If our primary goal is the generation of efficient code with the minimal
number of memory accesses, then a register is the prime candidate for
temporarily holding the function's result. If this solution is adopted, we
must renounce the capability of defining functions with a structured result,
because structured values cannot be held in a register.

If this restriction is considered as unacceptable, a place in the stack must
be reserved to hold the structured result. Typically, it is added to the
parameter area of the activation record. The function result is considered
as an implicit result (variable) parameter. Correspondingly, the stack
pointer is incremented before code for the first parameter is emitted."

http://www-old.oberon.ethz.ch/WirthPubl/CBEAll.pdf

Regards,
Chris Burrows

CFB Software
Armaide v2.0: ARM Oberon-07 Development System
http://www.cfbsoftware.com/armaide


----
To unsubscribe, send a message with body "SIGNOFF BLACKBOX" to LISTSERV{([at]})nowhere.xy----boundary-LibPST-iamunique-381935926_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"
e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZnJvbXRleHQgXGRlZmYwe1xmb250dGJsDQp7XGYwXGZz
d2lzcyBBcmlhbDt9DQp7XGYxXGZtb2Rlcm4gQ291cmllciBOZXc7fQ0Ke1xmMlxmbmlsXGZjaGFy
c2V0MiBTeW1ib2w7fQ0Ke1xmM1xmbW9kZXJuXGZjaGFyc2V0MCBDb3VyaWVyIE5ldzt9fQ0Ke1xj
b2xvcnRibFxyZWQwXGdyZWVuMFxibHVlMDtccmVkMFxncmVlbjBcYmx1ZTI1NTt9DQpcdWMxXHBh
cmRccGxhaW5cZGVmdGFiMzYwIFxmMFxmczIwICA+LS0tLS1PcmlnaW5hbCBNZXNzYWdlLS0tLS1c
cGFyDQo+RnJvbTogQmxhY2tCb3ggW21haWx0bzpCTEFDS0JPWEBMSVNUUy5PQkVST04uQ0hdIE9u
IEJlaGFsZiBPZiBSb2JlcnRccGFyDQo+U2VudDogV2VkbmVzZGF5LCAxIEp1bHkgMjAwOSA2OjE3
IEFNXHBhcg0KPlRvOiBCTEFDS0JPWEBMSVNUUy5PQkVST04uQ0hccGFyDQo+U3ViamVjdDogUmU6
IFtCTEFDS0JPWF0gQmxhY2tCb3ggMS42IGZpbmFsIHZlcnNpb24/IC0gQ29tcGxleCBudW1iZXJz
XHBhcg0KLi4uXHBhcg0KLi4uXHBhcg0KPlxwYXINCj4oKklmKikgb25lIGNob3NlIHRvIGltcGxl
bWVudCBDb21wbGV4IGFzIGEgUkVDT1JEIHR5cGUsIGFuZCB0byBccGFyDQo+aGF2ZSBDb21wbGV4
IGZ1bmN0aW9ucywgb25lIHdvdWxkIG5lZWQgdG8gYWxsb3cgUFJPQ0VEVVJFcyB0byBccGFyDQo+
cmV0dXJuIFJFQ09SRHMsIHdoaWNoIENvbXBvbmVudCBQYXNjYWwgZ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FpZGVccGFyDQpc
cGFyDQpccGFyDQotLS0tXHBhcg0KVG8gdW5zdWJzY3JpYmUsIHNlbmQgYSBtZXNzYWdlIHdpdGgg
Ym9keSAiU0lHTk9GRiBCTEFDS0JPWCIgdG8gTElTVFNFUlZATElTVFMuT0JFUk9OLkNIXHBhcg0K
fQ==
----boundary-LibPST-iamunique-381935926_-_---
Received on Wed Jul 01 2009 - 09:24:44 UTC

This archive was generated by hypermail 2.3.0 : Thu Sep 26 2013 - 06:30:46 UTC