|
Archives
D Programming
DD.gnu digitalmars.D digitalmars.D.bugs digitalmars.D.dtl digitalmars.D.dwt digitalmars.D.announce digitalmars.D.learn digitalmars.D.debugger C/C++ Programming
c++c++.announce c++.atl c++.beta c++.chat c++.command-line c++.dos c++.dos.16-bits c++.dos.32-bits c++.idde c++.mfc c++.rtl c++.stl c++.stl.hp c++.stl.port c++.stl.sgi c++.stlsoft c++.windows c++.windows.16-bits c++.windows.32-bits c++.wxwindows digitalmars.empire digitalmars.DMDScript |
D - 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.
Dec 29 2002
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. Dec 29 2002
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. Dec 30 2002
"Ilya Minkov" <midiclub 8ung.at> wrote in message news:aunba2$5ct$1 digitaldaemon.com...- Optional separators in numbers would increase readability, for Jan 21 2003
Walter wrote:"Ilya Minkov" <midiclub 8ung.at> wrote in message news:aunba2$5ct$1 digitaldaemon.com...- Optional separators in numbers would increase readability, for Jan 22 2003
"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 Jan 26 2003
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 Jan 22 2003
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? Jan 22 2003
"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 Jan 22 2003
Daniel Yokomiso wrote:8#123 Jan 22 2003
I'm currently reading Extended Pascal manual.
---8<---
12. Set extensions
A new operator >< is defined, which takes the symmetric difference of
two set values; there is a new predefined function card which returns
the cardinality of a set (the number of members present); and the FOR
statement allows a new form in which the control variable is given in
turn the values defined by a set.
FOR n IN setvalue DO ...
--->8---
I've already heard something similar was intended. Just that it's not
very practical without a "set" definition :) There it comes back - i
remember to have seen some advocates of pascal "set" a long time ago.
If set is not introduced as a separate type, it should be possible to
handle almost anything as a set. This might be good, since bitarrays and
associative arrays have a kind of similar behaviour.
BTW, that leads me to an idea that a separate implementation of
associative arrays can be made for small-ranged types. This would be
better than a Pascal's set, since it was limited to no more than
byte-indexed, and a associative array of bit has a similar semantics but
is more flexible. Just the performance may be tuned? Is there a
reasnoable way for 2 implementations to interact? I'll think about it.
-i.
Mar 17 2003
|