November 16, 2001 Re: two questions | ||||
---|---|---|---|---|
| ||||
Posted in reply to Russ Lewis | "Russ Lewis" <spamhole-2001-07-16@deming-os.org> wrote in message news:3BF54058.8FF6F560@deming-os.org... > Use PERL's syntax, since it's C-style and PERL is a common language that includes string concatenation. > > Use . as the array concatenation operator, and .= as the array append opeator :) Noooooo!!! (I hate Perl "."-concatenating!) |
November 16, 2001 Re: two questions | ||||
---|---|---|---|---|
| ||||
Posted in reply to Pavel Minayev | ??? I'd be interested why it's so bad. I have only a little experience with PERL, but it seemed to work fairly well as a syntax. -- The Villagers are Online! villagersonline.com .[ (the fox.(quick,brown)) jumped.over(the dog.lazy) ] .[ (a version.of(English).(precise.more)) is(possible) ] ?[ you want.to(help(develop(it))) ] |
November 16, 2001 Re: two questions | ||||
---|---|---|---|---|
| ||||
Posted in reply to Sean L. Palmer | Sean L. Palmer wrote: > "Walter" <walter@digitalmars.com> wrote in message news:9t130m$1egm$3@digitaldaemon.com... >> >> "Sean L. Palmer" <spalmer@iname.com> wrote in message >> > The "copying" syntax you suggest seems to leave it up to the compiler >> > to >> > realize it can avoid the copy. Debug builds could get very slow like >> that. >> >> It's not a problem for the compiler to optimize away the copy. > > But will it do so in a debug build? > > Seems a debug build could at least do a little "safe" optimization such as > (a = a + b) ==> (a += b) > > Sean Take a look at the GNU toolchain if you want to. gdb and gcc are together perfectly able to directly debug optimized code, with gcc/gdb it is generally not necessary to turn of the optimizer to be able to debug, at last I've never had to. With the advantage you can debug the thing like it really is. The only time I personally encountered debug builds vs. real builds was in the micrsoft toolchain, and how often did it happen that the application runs perfectly as debug build, but crashes as release? - Axel -- |D) http://www.dtone.org |
November 16, 2001 Re: two questions | ||||
---|---|---|---|---|
| ||||
Posted in reply to Russ Lewis | "Russ Lewis" <spamhole-2001-07-16@deming-os.org> wrote in message news:3BF55275.C595CC1D@deming-os.org... > I'd be interested why it's so bad. I have only a little experience with PERL, > but it seemed to work fairly well as a syntax. First of all, I don't see any "meaning" in it... using "+" for concatenation seems most logical, "&" - "and" - is not the worst choice as well. But definitely not "." The second thing is that in D context, dot is already used for other purpose. In fact, it could lead to confusion: char[] a; char length; a[].length; // concatenate a.length; // get length of a |
November 16, 2001 Re: two questions | ||||
---|---|---|---|---|
| ||||
Posted in reply to Pavel Minayev |
Pavel Minayev wrote:
>
> "Russ Lewis" <spamhole-2001-07-16@deming-os.org> wrote in message news:3BF55275.C595CC1D@deming-os.org...
>
> > I'd be interested why it's so bad. I have only a little experience with
> PERL,
> > but it seemed to work fairly well as a syntax.
>
> First of all, I don't see any "meaning" in it... using "+"
> for concatenation seems most logical, "&" - "and" - is
> not the worst choice as well. But definitely not "."
>
> The second thing is that in D context, dot is already
> used for other purpose.
I'll just point out here that while both those arguments are valid in the D context, neither is valid in the Perl context[1].
-RB
[1] Strings and numbers are automatically convertible,
so that "1.0" + "2.0" = "3.0" (or maybe just "3" or "3."),
likewise &, so those aren't free for concatenation.
Perl generally uses {} or -> for object membership.
|
November 17, 2001 Re: two questions | ||||
---|---|---|---|---|
| ||||
Posted in reply to Russ Lewis | My problem with . as concatenation is the . binary operator is already in use, and I was afraid the . would be too small. "Russ Lewis" <spamhole-2001-07-16@deming-os.org> wrote in message news:3BF55275.C595CC1D@deming-os.org... > ??? > > I'd be interested why it's so bad. I have only a little experience with PERL, > but it seemed to work fairly well as a syntax. > > -- > The Villagers are Online! villagersonline.com > > .[ (the fox.(quick,brown)) jumped.over(the dog.lazy) ] > .[ (a version.of(English).(precise.more)) is(possible) ] > ?[ you want.to(help(develop(it))) ] > > |
November 17, 2001 Re: two questions | ||||
---|---|---|---|---|
| ||||
Posted in reply to Pavel Minayev | "Pavel Minayev" <evilone@omen.ru> wrote in message news:9t30p7$1rn5$1@digitaldaemon.com... > "Walter" <walter@digitalmars.com> wrote in message news:9t2kmn$16ah$2@digitaldaemon.com... > > That's now no longer true. Looks like I missed fixing that in the doc. > So now the ~= syntax is used on strings as well? Yes. > Kinda weird. If I didn't know that it means append, and > saw it for the first time, I would rather think of it > as of remove substring from a string... or something > like that. But definitely not append. Maybe &= then - > since BASIC already uses & for string concatenation? D needed an operator token that was not already in use. |
November 17, 2001 Re: two questions | ||||
---|---|---|---|---|
| ||||
Posted in reply to Russell Borogove | "Russell Borogove" <kaleja@estarcion.com> wrote in message news:3BF58CF9.62606AF3@estarcion.com... > > First of all, I don't see any "meaning" in it... using "+" > > for concatenation seems most logical, "&" - "and" - is > > not the worst choice as well. But definitely not "." > > > > The second thing is that in D context, dot is already > > used for other purpose. > > I'll just point out here that while both those arguments are valid in the D context, neither is valid in the Perl context[1]. I know about the second (but we were talking about D, no?). Still, I don't see any reason for using dot, whether it is in Perl or in any other language. It's not intuitive. |
November 17, 2001 Re: two questions | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | "Walter" <walter@digitalmars.com> wrote in message news:9t4v38$13t3$3@digitaldaemon.com... > > > That's now no longer true. Looks like I missed fixing that in the doc. > > So now the ~= syntax is used on strings as well? > > Yes. And what about string concatenation? Is "~" used for this as well? > D needed an operator token that was not already in use. Why? You can't add anything to char in D (since it's not integer), or ain't I right? |
November 17, 2001 Re: two questions | ||||
---|---|---|---|---|
| ||||
Posted in reply to Pavel Minayev | "Pavel Minayev" <evilone@omen.ru> wrote in message news:9t53i1$16mq$2@digitaldaemon.com... > > "Walter" <walter@digitalmars.com> wrote in message news:9t4v38$13t3$3@digitaldaemon.com... > > > > > That's now no longer true. Looks like I missed fixing that in the doc. > > > So now the ~= syntax is used on strings as well? > > > > Yes. > > And what about string concatenation? Is "~" used for this as well? As a binary operator, yes. > > D needed an operator token that was not already in use. > Why? You can't add anything to char in D (since it's not > integer), or ain't I right? Sure you can add to chars. That's how to convert upper case to lower case! |
Copyright © 1999-2021 by the D Language Foundation