Re: [BLACKBOX] Using IN for big comparsions

From: [at]} <CFB>
Date: Tue, 26 Feb 2008 11:08:18 +1030

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

> -----Original Message-----
> From: BlackBox [mailto:BLACKBOX{([at]})nowhere.xy
> Oleg N. Cher
> Sent: Tuesday, 26 February 2008 8:33 AM
> To: BLACKBOX{([at]})nowhere.xy
> Subject: [BLACKBOX] Using IN for big comparsions (Was:
> Read-only IN parameters for all data types)
>
> Btw, I like language Pascal, in comparison with C, than:
>
> Pascal:
>
> IF x IN [0..31] AND y IN [0..23] THEN ... ;

>

Me too. Of course you can do exactly this sort of thing in Component Pascal
as well (as long as you don't go higher than 31 or lower than 0).

>
> 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.
>

Agreed. However, you can already do exactly this in a slightly different way
in Oberon / Component Pascal:

  CASE i OF 0..1000: DoSomething ELSE END;

I wouldn't necessarily write code like this (i.e. a CASE statement with only
one choice) and would hesitate to encourage others to do so, but if that is
really what you want to do you can do it. Maybe it only seems unnatural to
us because of our existing ingrained habits and preconceived ideas?

But why stop at IF a IN {0..1000} THEN DoSomething END; ?

If the next thing you say is that you would really like to be able to have:

  If card IN {6..9, king, ace} THEN DoSomething END;

I can tell you that you can already write:

  CASE card OF 6..9, king, ace: DoSomething ELSE END;

My point is, why put a whole lot of additional complexity into the compiler
for IF statements if the functionality already exists in an alternative
statement? I'm all for contemplating language features that allow you to do
something that you cannot already easily achieve (e.g. type-extension in
Oberon). Otherwise, taken to extremes the end result is a overly-complex
bloated language monstrosity like Delphi or PERL where you spend more of
your time deciding which of 99 different ways you should write a statement
than actually writing it. I had enough difficulty when I was a newbie trying
to decide whether to use a REPEAT or a WHILE ;-)

P.S. Despite what I say - I do not disagree with you 100% - I'm primarily
putting forward an alternative viewpoint.

Regards,
Chris

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


----
To unsubscribe, send a message with body "SIGNOFF BLACKBOX" to LISTSERV{([at]})nowhere.xy----boundary-LibPST-iamunique-1542461345_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"
e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZnJvbXRleHQgXGRlZmYwe1xmb250dGJsDQp7XGYwXGZz
d2lzcyBBcmlhbDt9DQp7XGYxXGZtb2Rlcm4gQ291cmllciBOZXc7fQ0Ke1xmMlxmbmlsXGZjaGFy
c2V0MiBTeW1ib2w7fQ0Ke1xmM1xmbW9kZXJuXGZjaGFyc2V0MCBDb3VyaWVyIE5ldzt9fQ0Ke1xj
b2xvcnRibFxyZWQwXGdyZWVuMFxibHVlMDtccmVkMFxncmVlbjBcYmx1ZTI1NTt9DQpcdWMxXHBh
cmRccGxhaW5cZGVmdGFiMzYwIFxmMFxmczIwID4gLS0tLS1PcmlnaW5hbCBNZXNzYWdlLS0tLS1c
cGFyDQo+IEZyb206IEJsYWNrQm94IFttYWlsdG86QkxBQ0tCT1hATElTVFMuT0JFUk9OLkNIXSBP
biBCZWhhbGYgT2YgXHBhcg0KPiBPbGVnIE4uIENoZXJccGFyDQo+IFNlbnQ6IFR1ZXNkYXksIDI2
IEZlYnJ1YXJ5IDIwMDggODozMyBBTVxwYXINCj4gVG86IEJMQUNLQk9YQExJU1RTLk9CRVJPTi5D
SFxwYXINCj4gU3ViamVjdDogW0JMQUNLQk9YXSBVc2luZyBJTiBmb3IgYmlnIGNvbXBhcnNpb25z
IChXYXM6IFxwYXINCj4gUmVhZC1vbmx5IElOIHBhcmFtZXRlcnMgZm9yIGFsbCBkYXRhIHR5cGVz
KVxwYXINCj4gXHBhcg0KPiBCdHcsIEkgbGlrZSBsYW5ndWFnZSBQYXNjYWwsIGluIGNvbXBhcmlz
b24gd2l0aCBDLCB0aGFuOlxwY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
Z2FyZHMsXHBhcg0KQ2hyaXNccGFyDQpccGFyDQpDaHJpcyBCdXJyb3dzXHBhcg0KQ0ZCIFNvZnR3
YXJlXHBhcg0KaHR0cDovL3d3dy5jZmJzb2Z0d2FyZS5jb20vY3BccGFyDQpccGFyDQpccGFyDQot
LS0tXHBhcg0KVG8gdW5zdWJzY3JpYmUsIHNlbmQgYSBtZXNzYWdlIHdpdGggYm9keSAiU0lHTk9G
RiBCTEFDS0JPWCIgdG8gTElTVFNFUlZATElTVFMuT0JFUk9OLkNIXH19AHdpdA==
----boundary-LibPST-iamunique-1542461345_-_---
Received on Tue Feb 26 2008 - 01:38:18 UTC

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