Re: [BLACKBOX] Read-only IN parameters for all data types

From: [at]} <CFB>
Date: Thu, 21 Feb 2008 00:26:14 +1030

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

> -----Original Message-----
> From: BlackBox [mailto:BLACKBOX{([at]})nowhere.xy
> Oleg N. Cher
> Sent: Wednesday, 20 February 2008 8:32 PM
> To: BLACKBOX{([at]})nowhere.xy
> Subject: Re: [BLACKBOX] Read-only IN parameters for all data types
>
> But, as shows experience, Delphi programmers more often
> do not like use the CONST in such a way.
> They prefer to use the most simple way of recording of
> transmitted parameters:
>
> PROCEDURE Do (a: INTEGER);
>

Are you sure that is the reason or is it just old Pascal habits? I often
simply forget to use CONST in my Delphi code because I spent so many years
coding in Pascal before it was introduced.

>
> Prof. Wirth is a good psychologist of programming.
> He knows that too big number of excessive possiblities
> generates bulky languages.

Yes, and he has also included CONST parameters in his latest (small)
language design Oberon-SA (2007).

>
> Instead of it I suggest to expand a way of use IN so:
>
> IF a IN {0..1000} THEN ... END;
>
> Current BlackBox realization does not accept such using of sets.
> But such way of recording is good and evident. What will say?
>

Sets are useful but large sets do suffer from hidden inefficiencies.
However, the example does not demonstrate their usefulness well as the
alternative is not too cumbersome:

  IF (a >= 0) & (a <= 1000) THEN ... END;

If you wanted to code something like this however,

 IF a IN {'a', 'e', 'i', 'o', 'u'} THEN

large sets might appear more attractive, but they are still not really
necessary as there is another alternative.

Oberon doesn't usually have several different ways of doing exactly the same
thing. In practice, these sorts of complex tests often are more suited to a
CASE statement than an IF statement. Consequently that is where you will
find a lot of flexibility with subranges and collections e.g.

    CASE s[i] OF
    'a', 'e', 'i', 'o', 'u':
      INC(vowels);
      INC(letters) |
    'A', 'E', 'I', 'O', 'U':
      INC(vowels);
      INC(letters);
      INC(capitals) |
    'b'..'d', 'f'..'h', 'j'..'n', 'p'..'t', 'v'..'z':
      INC(letters) |
    ...

Apologies for the biased choice of alphabet ;-)

Regards,
Chris


----
To unsubscribe, send a message with body "SIGNOFF BLACKBOX" to LISTSERV{([at]})nowhere.xy----boundary-LibPST-iamunique-1290940418_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"
e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZnJvbXRleHQgXGRlZmYwe1xmb250dGJsDQp7XGYwXGZz
d2lzcyBBcmlhbDt9DQp7XGYxXGZtb2Rlcm4gQ291cmllciBOZXc7fQ0Ke1xmMlxmbmlsXGZjaGFy
c2V0MiBTeW1ib2w7fQ0Ke1xmM1xmbW9kZXJuXGZjaGFyc2V0MCBDb3VyaWVyIE5ldzt9fQ0Ke1xj
b2xvcnRibFxyZWQwXGdyZWVuMFxibHVlMDtccmVkMFxncmVlbjBcYmx1ZTI1NTt9DQpcdWMxXHBh
cmRccGxhaW5cZGVmdGFiMzYwIFxmMFxmczIwID4gLS0tLS1PcmlnaW5hbCBNZXNzYWdlLS0tLS1c
cGFyDQo+IEZyb206IEJsYWNrQm94IFttYWlsdG86QkxBQ0tCT1hATElTVFMuT0JFUk9OLkNIXSBP
biBCZWhhbGYgT2YgXHBhcg0KPiBPbGVnIE4uIENoZXJccGFyDQo+IFNlbnQ6IFdlZG5lc2RheSwg
MjAgRmVicnVhcnkgMjAwOCA4OjMyIFBNXHBhcg0KPiBUbzogQkxBQ0tCT1hATElTVFMuT0JFUk9O
LkNIXHBhcg0KPiBTdWJqZWN0OiBSZTogW0JMQUNLQk9YXSBSZWFkLW9ubHkgSU4gcGFyYW1ldGVy
cyBmb3IgYWxsIGRhdGEgdHlwZXNccGFyDQo+IFxwYXINCj4gQnV0LCBhcyBzaG93cyBleHBlcmll
bmNlLCBEZWxwaGkgcHJvZ3JhbW1lcnMgbW9yZSBvZnRlblxwYXINCj4gZG8gbm90IGxpa2UgdXNl
IHRoZSBDT05TVCBpbiBzdWNoIGEgd2F5LlxwYXINCj4gVGhleSBwcmVmZXIgdG8gdXNlIHRoZSBt
b3N0IHNpbXBsZSB3YXkgb2YgcmVjb3JkaW5n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VxdWVudGx5IHRoYXQgaXMgd2hlcmUgeW91IHdpbGxccGFyDQpmaW5kIGEgbG90
IG9mIGZsZXhpYmlsaXR5IHdpdGggc3VicmFuZ2VzIGFuZCBjb2xsZWN0aW9ucyBlLmcuXHBhcg0K
XHBhcg0KICAgIENBU0Ugc1tpXSBPRlxwYXINCiAgICAnYScsICdlJywgJ2knLCAnbycsICd1Jzpc
cGFyDQogICAgICBJTkModm93ZWxzKTtccGFyDQogICAgICBJTkMobGV0dGVycykgfFxwYXINCiAg
ICAnQScsICdFJywgJ0knLCAnTycsICdVJzpccGFyDQogICAgICBJTkModm93ZWxzKTtccGFyDQog
ICAgICBJTkMobGV0dGVycyk7XHBhcg0KICAgICAgSU5DKGNhcGl0YWxzKSB8XHBhcg0KICAgICdi
Jy4uJ2QnLCAnZicuLidoJywgJ2onLi4nbicsICdwJy4uJ3QnLCAndicuLid6JzpccGFyDQogICAg
ICBJTkMobGV0dGVycykgfFxwYXINCiAgICAuLi5ccGFyDQpccGFyDQpBcG9sb2dpZXMgZm9yIHRo
ZSBiaWFzZWQgY2hvaWNlIG9mIGFscGhhYmV0IDstKVxwYXINClxwYXINClJlZ2FyZHMsXHBhcg0K
Q2hyaXNccGFyDQpccGFyDQpccGFyDQotLS0tXHBhcg0KVG8gdW5zdWJzY3JpYmUsIHNlbmQgYSBt
ZXNzYWdlIHdpdGggYm9keSAiU0lHTk9GRiBCTEFDS0JPWCIgdG8gTElTVFNFUlZATElTVFMuT0JF
Uk9OLkNIXH19AHNjcg==
----boundary-LibPST-iamunique-1290940418_-_---
Received on Wed Feb 20 2008 - 14:56:14 UTC

This archive was generated by hypermail 2.3.0 : Thu Sep 26 2013 - 06:31:00 UTC