(unknown charset) [BLACKBOX] Using IN for big comparsions (Was: Read-only IN parameters for all data types)

From: (unknown charset) Oleg N. Cher <"Oleg>
Date: Tue, 26 Feb 2008 00:02:36 +0200

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

Dear Chris,

Our discussion about IN was long, and I must agree with you.
Eventually use of arguments IN carries the advantages.

Btw, I like language Pascal, in comparison with C, than:

Pascal:

IF x IN [0..31] AND y IN [0..23] THEN ... ;

C:

if((x >= 0) & (x <= 31) & (y >= 0) & (y <= 23)) ... ;

Pascal:

CASE inChar OF
 'a'..'z' : ...
 Enter : ...
 Space : ...

switch/case/break of language C does not provide so well
functionality, and we must use:

if((inChar >= 'a') & (inChar <= 'z')) ... ;
if(inChar = Enter) ... ;
if(inChar = Space) ... ;

Or, do you remember?

 case 0: case 1: case 2: case 3: case 4 ...

It as it seems to me, lacks of designing of language.
I'm not propose to use huge or big SETs in Oberon.
I propose this way of writing:

    IF a IN {0..1000} THEN ... END;

    Instead of

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

Because such way of writing is represented to me more
readable, evident, understandable and natural.

At the same time any Oberon standards do not limit final
value of SET.

We can continue using of SETs by old way, but teach the compiler
of Component Pascal understand big comparisons as ocurrences
in a subset (without use of any set).
Eventually, a macroprocessor can make it even.

>> 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
= = = = = = = = = = = = = = = = = = = =
                        
P.S. Aubrey McIntosh, thank you for your letter. It's very good.


Oleg N. Cher,
Colossoft Research.
allot{([at]})nowhere.xy
2008-02-25


----
To unsubscribe, send a message with body "SIGNOFF BLACKBOX" to LISTSERV{([at]})nowhere.xy----boundary-LibPST-iamunique-821160383_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"
e1xydGYxXGFuc2lcYW5zaWNwZzEyNTFcZnJvbXRleHQgXGRlZmYwe1xmb250dGJsDQp7XGYwXGZz
d2lzcyBBcmlhbDt9DQp7XGYxXGZtb2Rlcm4gQ291cmllciBOZXc7fQ0Ke1xmMlxmbmlsXGZjaGFy
c2V0MiBTeW1ib2w7fQ0Ke1xmM1xmbW9kZXJuXGZjaGFyc2V0MCBDb3VyaWVyIE5ldzt9fQ0Ke1xj
b2xvcnRibFxyZWQwXGdyZWVuMFxibHVlMDtccmVkMFxncmVlbjBcYmx1ZTI1NTt9DQpcdWMxXHBh
cmRccGxhaW5cZGVmdGFiMzYwIFxmMFxmczIwIERlYXIgQ2hyaXMsXHBhcg0KXHBhcg0KT3VyIGRp
c2N1c3Npb24gYWJvdXQgSU4gd2FzIGxvbmcsIGFuZCBJIG11c3QgYWdyZWUgd2l0aCB5b3UuXHBh
cg0KRXZlbnR1YWxseSB1c2Ugb2YgYXJndW1lbnRzIElOIGNhcnJpZXMgdGhlIGFkdmFudGFnZXMu
XHBhcg0KXHBhcg0KQnR3LCBJIGxpa2UgbGFuZ3VhZ2UgUGFzY2FsLCBpbiBjb21wYXJpc29uIHdp
dGggQ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k9YIiB0byBMSVNUU0VSVkBMSVNUUy5PQkVST04uQ0h9
fQB+ACh7
----boundary-LibPST-iamunique-821160383_-_---
Received on Mon Feb 25 2008 - 23:02:36 UTC

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