Thread overview | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
December 29, 2002 Syntactical ideas. | ||||
---|---|---|---|---|
| ||||
I've been collecting ideas for D and have a couple. - Shortcut object access. If you have asome long path to the object currently processing you could write: with MainForm.BigPanel.ThisButton do { Text = "Blah"; Width = 40; some_external_variable = 1; } Please note that external object access should be no problem, and name conflicts are resolved with higher priority to the with statement. This idea has been taken from Delphi. - Optional separators in numbers would increase readability, for example: int Million = 1_000_000; float Pi = 3.14159_26535_89793; This idea has been taken from ADA-95. - Non-decimal numbers in every possible base: 'base#number', where base need not be bound to usual 2,8 and so on. However, more than 36 doesn't appear possible or make sense: 10 decimals and 26 letters of alpabet. This idea has been taken from GPC, the GNU Pascal Compiler. Please also read about the ocaml-like patternmatcher. -i. |
December 30, 2002 Re: Syntactical ideas. | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ilya Minkov | Ilya Minkov <midiclub@8ung.at> wrote in news:aunba2$5ct$1@digitaldaemon.com: > I've been collecting ideas for D and have a couple. > > > - Shortcut object access. > http://www.digitalmars.com/d/statement.html#with |
December 30, 2002 Re: Syntactical ideas. | ||||
---|---|---|---|---|
| ||||
Posted in reply to Patrick Down | Sorry, overlooked. I'm new to D.
Patrick Down wrote:
> Ilya Minkov <midiclub@8ung.at> wrote in
> news:aunba2$5ct$1@digitaldaemon.com:
>
>
>>I've been collecting ideas for D and have a couple.
>>
>>
>> - Shortcut object access.
>>
>
>
> http://www.digitalmars.com/d/statement.html#with
|
January 22, 2003 Re: Syntactical ideas. | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ilya Minkov | "Ilya Minkov" <midiclub@8ung.at> wrote in message news:aunba2$5ct$1@digitaldaemon.com... > - Optional separators in numbers would increase readability, for example: > > int Million = 1_000_000; > float Pi = 3.14159_26535_89793; > > This idea has been taken from ADA-95. Does any language but ADA do this? If not, I'm not sure how useful in practice it is. It has the advantage of being simple to implement. > - Non-decimal numbers in every possible base: 'base#number', where > base need not be bound to usual 2,8 and so on. However, more than 36 > doesn't appear possible or make sense: 10 decimals and 26 letters of > alpabet. > > This idea has been taken from GPC, the GNU Pascal Compiler. I'm sorry, but I haven't in 25 years of programming ever seen any use for bases other than binary, octal, decimal, and hex, and octal appears to now be obsolete. There was a thread here a while back about dumping support for octal. |
January 22, 2003 Re: Syntactical ideas. | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | Walter wrote:
>
> "Ilya Minkov" <midiclub@8ung.at> wrote in message news:aunba2$5ct$1@digitaldaemon.com...
>> - Optional separators in numbers would increase readability, for
> example:
>>
>> int Million = 1_000_000;
>> float Pi = 3.14159_26535_89793;
>>
>> This idea has been taken from ADA-95.
>
> Does any language but ADA do this? If not, I'm not sure how useful in practice it is. It has the advantage of being simple to implement.
Sather does - the idea having been taken from Ada95, I suppose. :-)
I'd say, just include it. Doesn't hurt anybody, and obviously at least a few people like it.
|
January 22, 2003 Re: Syntactical ideas. | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | LX appears to implement both of these ideas.
As to the use of base#num, you could eliminate the octal "0123" numbers which is more often a bug than not. If someone needs octal, he would write:
8#123
Hm. Can't think of any real use. Maybe some scientists among here show up and give an idea?
Walter wrote:
> "Ilya Minkov" <midiclub@8ung.at> wrote in message
> news:aunba2$5ct$1@digitaldaemon.com...
>
>> - Optional separators in numbers would increase readability, for
>
> example:
>
>>int Million = 1_000_000;
>>float Pi = 3.14159_26535_89793;
>>
>>This idea has been taken from ADA-95.
>
>
> Does any language but ADA do this? If not, I'm not sure how useful in
> practice it is. It has the advantage of being simple to implement.
>
>
>
>> - Non-decimal numbers in every possible base: 'base#number', where
>>base need not be bound to usual 2,8 and so on. However, more than 36
>>doesn't appear possible or make sense: 10 decimals and 26 letters of
>>alpabet.
>>
>>This idea has been taken from GPC, the GNU Pascal Compiler.
>
>
> I'm sorry, but I haven't in 25 years of programming ever seen any use for
> bases other than binary, octal, decimal, and hex, and octal appears to now
> be obsolete. There was a thread here a while back about dumping support for
> octal.
>
|
January 22, 2003 Re: Syntactical ideas. | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ilya Minkov | Ilya Minkov wrote:
> LX appears to implement both of these ideas.
>
> As to the use of base#num, you could eliminate the octal "0123" numbers which is more often a bug than not. If someone needs octal, he would write:
> 8#123
>
> Hm. Can't think of any real use. Maybe some scientists among here show up and give an idea?
Seems like varied-base numbers are far more important for user I/O than for programming constants. After all, you can always code it manually, and comment your code:
int foo = 83; // 83 decimal is 123 octal
|
January 22, 2003 Re: Syntactical ideas. | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ilya Minkov | "Ilya Minkov" <midiclub@tiscali.de> escreveu na mensagem news:b0m1s6$119k$1@digitaldaemon.com... > LX appears to implement both of these ideas. > > As to the use of base#num, you could eliminate the octal "0123" numbers which is more often a bug than not. If someone needs octal, he would write: > 8#123 > > Hm. Can't think of any real use. Maybe some scientists among here show up and give an idea? > During my physics grad course I'd never used anything except base 10. Sometimes I toy around with hex or binary, but I can convert between them easily, so no problem here. If D had any syntax for arbitrary bases, each line of code using them for anything else octal, binary or hexadecimal would raise my bug alarm. int foo = 27#198BH8S; But it would be great for obfuscation ;-) --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.443 / Virus Database: 248 - Release Date: 10/1/2003 |
January 22, 2003 Re: Syntactical ideas. | ||||
---|---|---|---|---|
| ||||
Posted in reply to Daniel Yokomiso | Daniel Yokomiso wrote:
>>8#123
> During my physics grad course I'd never used anything except base 10.
> Sometimes I toy around with hex or binary, but I can convert between them
> easily, so no problem here. If D had any syntax for arbitrary bases, each
> line of code using them for anything else octal, binary or hexadecimal would
> raise my bug alarm.
>
> int foo = 27#198BH8S;
>
> But it would be great for obfuscation ;-)
Right. Storing lowercase text in a compressed form :>
-i.
|
January 27, 2003 Re: Syntactical ideas. | ||||
---|---|---|---|---|
| ||||
Posted in reply to Norbert Nemec | "Norbert Nemec" <nobbi_at_theorie3.physik.uni-erlangen.de@NOSPAM.COM> wrote in message news:b0logj$rim$2@digitaldaemon.com... > I'd say, just include it. Doesn't hurt anybody, and obviously at least a few > people like it. Every added feature makes the language larger and buggier. I need a compelling case for a new feature. |
Copyright © 1999-2021 by the D Language Foundation