BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

features request ;)

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Non-Technical
View previous topic :: View next topic  
Author Message
Andrew Rybenkov
Guest





PostPosted: Wed Jul 28, 2004 3:33 pm    Post subject: features request ;) Reply with quote



a) Extend subrange type definition to make possible something like that:

MyType = 1..10, 77, 100..200;

b) permit using other defined subrange types in type definition, like

MyExtType = 0, MyType, 201..299;

c) in case of b) - also adding "include" and "exclude" words to type defs:

MyNewType = MyType exclude 77, 113..119 include 777;


--
Andrew Rybenkov.




Back to top
TObject
Guest





PostPosted: Wed Jul 28, 2004 5:33 pm    Post subject: Re: features request ;) Reply with quote



I am curious, where would you use such bizarre types?


Back to top
Andrew Rybenkov
Guest





PostPosted: Wed Jul 28, 2004 5:58 pm    Post subject: Re: features request ;) Reply with quote



Quote:
I am curious, where would you use such bizarre types?

the same places where I would use "normal" subrange types.


--
Andrew Rybenkov.




Back to top
TObject
Guest





PostPosted: Wed Jul 28, 2004 6:06 pm    Post subject: Re: features request ;) Reply with quote


"Andrew Rybenkov" <arybenkov (AT) hotmail (DOT) com> wrote


Quote:
I am curious, where would you use such bizarre types?

the same places where I would use "normal" subrange types.

The ones in your examples are far from "normal".



Back to top
Andrew Rybenkov
Guest





PostPosted: Wed Jul 28, 2004 7:52 pm    Post subject: Re: features request ;) Reply with quote

Quote:
The ones in your examples are far from "normal".

firstly, "normal" subrange types are those that can be defined in Pascal/Delphi now.
secondly, when one provides an example to simplify understanding of his/her idea,
he/she tries to make the example simple as much as possible

A bit more meaningful example:

type
PrimesLessThan20 = 2..3,5,7;11,13,17,19;

type
PrimesLessThan10 = PrimesLessThan20 exclude 10..19;

I would like compiler {R+}-check a PrimesLessThan10 at the debugging phase, regardless
computing burden such declarations will produce.


--
Andrew Rybenkov.




Back to top
Robert Marquardt
Guest





PostPosted: Wed Jul 28, 2004 7:59 pm    Post subject: Re: features request ;) Reply with quote

Andrew Rybenkov wrote:

Quote:
a) Extend subrange type definition to make possible something like that:

MyType = 1..10, 77, 100..200;

b) permit using other defined subrange types in type definition, like

MyExtType = 0, MyType, 201..299;

c) in case of b) - also adding "include" and "exclude" words to type defs:

MyNewType = MyType exclude 77, 113..119 include 777;


--
Andrew Rybenkov.

This is a typical request from a newbie to language design.
Did you think it through? Apart from the syntactical challenges it
contains general problems with illegal values etc. Not to mention the
implementation horror.


Back to top
Brion L. Webster
Guest





PostPosted: Wed Jul 28, 2004 8:08 pm    Post subject: Re: features request ;) Reply with quote

TObject wrote:

Quote:

"Andrew Rybenkov" <arybenkov (AT) hotmail (DOT) com> wrote...

I am curious, where would you use such bizarre types?

the same places where I would use "normal" subrange types.

The ones in your examples are far from "normal".

I could see, if, by chance, you hard coded "product ID's", you
might want to exclude discontinued products, or products in a
different line. Hard coding Product ID's is a sub-optimal idea,
but I can at least see where discontinous ranges might be useful.
They pop up in math all the time.

-Brion

Back to top
TObject
Guest





PostPosted: Wed Jul 28, 2004 8:29 pm    Post subject: Re: features request ;) Reply with quote

That makes sense. Thank you.


Back to top
Andrew Rybenkov
Guest





PostPosted: Wed Jul 28, 2004 9:14 pm    Post subject: Re: features request ;) Reply with quote

Quote:
... a newbie to language design.

Smile)))

Quote:
Did you think it through?

I think so.

Quote:
it contains general problems with illegal values etc.

what are those problems (different from usual subrange ones)?

Quote:
Not to mention the implementation horror.

any sophisticated program (and a compiler certainly is) is an implementation horror.

~40 years ago (when computing science was rather young) they were able to produce
working compilers for such mammoths as PL/1 or, especially, Algol-68, and it did not took decades.


--
Andrew Rybenkov.




Back to top
Daniel Becroft
Guest





PostPosted: Thu Jul 29, 2004 2:08 am    Post subject: Re: features request ;) Reply with quote

Andrew Rybenkov wrote:

Quote:
The ones in your examples are far from "normal".

firstly, "normal" subrange types are those that can be defined in Pascal/Delphi now.
secondly, when one provides an example to simplify understanding of his/her idea,
he/she tries to make the example simple as much as possible

A bit more meaningful example:

type
PrimesLessThan20 = 2..3,5,7;11,13,17,19;

type
PrimesLessThan10 = PrimesLessThan20 exclude 10..19;

I would like compiler {R+}-check a PrimesLessThan10 at the debugging phase, regardless
computing burden such declarations will produce.

Personally, I would prefer set constructs over include/exclude keywords.

Like:
type
PrimesLessThan20 = 2..3,5,6;11,13,17,19;

type
PrimesLessThan10 = PrimesLessThan20 - 10..19; { set 'difference' operation }

That, to me, would be more useful, and could allow for more possibilities. You could use
intersection to use only the common values, union to use all values, etc.

--
Daniel Becroft
; =================================
"Real computer scientists don't comment their code. The identifiers are so long they can't afford
the disk space."

"Blue sparks and white smoke, the two most expensive components of any electrical system, and once
used up will cost a fortune to replace."

Back to top
Hallvard Vassbotn
Guest





PostPosted: Thu Jul 29, 2004 7:08 am    Post subject: Re: features request ;) Reply with quote

Andrew Rybenkov wrote:
Quote:
a) Extend subrange type definition to make possible something like
that:

MyType = 1..10, 77, 100..200;

That isn't a subrange. A subrange is a range between two numbers (min..max).

You could define this as a set, of course:

MyType = [1..10, 77, 100..200];

Sets do support your b) and c) requests too.

But from your other post it looks like you want this to be implemented as an
array or list?



Back to top
Andrew Rybenkov
Guest





PostPosted: Thu Jul 29, 2004 11:47 am    Post subject: Re: features request ;) Reply with quote

Quote:
Personally, I would prefer set constructs over include/exclude keywords.

that would be ideally.


--
Andrew Rybenkov.




Back to top
Andrew Rybenkov
Guest





PostPosted: Thu Jul 29, 2004 11:49 am    Post subject: Re: features request ;) Reply with quote

Quote:
You could define this as a set, of course:

set is set, number is number.

Quote:
But from your other post it looks like you want this to be implemented as an
array or list?

not at all, just simple number with difinite values.

--
Andrew Rybenkov.




Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Non-Technical All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.