July 10, 2009 Re: Case Range Statement .. | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Bill Baxter | Bill Baxter wrote: > On Thu, Jul 9, 2009 at 9:09 PM, Walter Bright<newshound1@digitalmars.com> wrote: >> Bill Baxter wrote: >>> If it's internal to the parse tree can't you make the syntax whatever you >>> want? >>> Something like (expr1 __exprSequencer expr2) should do just fine, right? >>> No reason it has to be a precious one-character symbol syntax. >> What if you're writing a program that generates D code? > > If you're generating code which is so tricky that it needs to rely on > comma expressions, Writing code that requires that "A" be executed before "B" is not tricky or unusual. > then I doubt it will be something that users will > be expected to read and/or edit. In which case, again, it doesn't > matter how ugly the syntax is. "__exprSequencer" would do just fine. Making D metaprogramming spectacularly ugly will not help bring metaprogramming to the mainstream and will drive away the kind of people who can create fantastic metaprogramming applications. | |||
July 10, 2009 Re: Case Range Statement .. | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | Walter Bright wrote:
> Bill Baxter wrote:
>> On Thu, Jul 9, 2009 at 9:09 PM, Walter Bright<newshound1@digitalmars.com> wrote:
>>> Bill Baxter wrote:
>>>> If it's internal to the parse tree can't you make the syntax whatever you
>>>> want?
>>>> Something like (expr1 __exprSequencer expr2) should do just fine, right?
>>>> No reason it has to be a precious one-character symbol syntax.
>>> What if you're writing a program that generates D code?
>>
>> If you're generating code which is so tricky that it needs to rely on
>> comma expressions,
>
> Writing code that requires that "A" be executed before "B" is not tricky or unusual.
>
>> then I doubt it will be something that users will
>> be expected to read and/or edit. In which case, again, it doesn't
>> matter how ugly the syntax is. "__exprSequencer" would do just fine.
>
> Making D metaprogramming spectacularly ugly will not help bring metaprogramming to the mainstream and will drive away the kind of people who can create fantastic metaprogramming applications.
Is the comma operator used in any of the metaprogramming of phobos? Or Tango? Or anywhere else?
| |||
July 10, 2009 Re: Case Range Statement .. | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Walter Bright Attachments:
| Walter Bright wrote: > Jérôme M. Berger wrote: >> I've always felt they were useless and confusing. What's the >> advantage of "y = (foo(), x + 3);" over "foo(); y = x+3;"? > > When you only see the x+3 because you're recursively walking the tree generating code. > >>> It's handy for things like rewriting ++e so it can be used more than once but is only evaluated once: >>> >>> (tmp = ++e, tmp) >> >> Uh? How is that different from "++e" > > You can then use tmp more than once with only one increment of e. I guess I'll need a complete concrete example before I understand. I mean: tmp = ++e; veryComplexExpressionThatUsesTmpSeveralTimesWithoutTouchingE; Or even: ++e; veryComplexExpressionThatUsesESeveralTimesWithoutIncrementingIt; Are both clearer, less error-prone and should produce equivalent code to the coma expression. Jerome -- mailto:jeberger@free.fr http://jeberger.free.fr Jabber: jeberger@jabber.fr | |||
July 10, 2009 Re: Case Range Statement .. | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | On Fri, Jul 10, 2009 at 12:24 PM, Walter Bright<newshound1@digitalmars.com> wrote: > Bill Baxter wrote: >> >> On Thu, Jul 9, 2009 at 9:09 PM, Walter Bright<newshound1@digitalmars.com> wrote: >>> >>> Bill Baxter wrote: >>>> >>>> If it's internal to the parse tree can't you make the syntax whatever >>>> you >>>> want? >>>> Something like (expr1 __exprSequencer expr2) should do just fine, right? >>>> No reason it has to be a precious one-character symbol syntax. >>> >>> What if you're writing a program that generates D code? >> >> If you're generating code which is so tricky that it needs to rely on comma expressions, > > Writing code that requires that "A" be executed before "B" is not tricky or unusual. Right. And usually that's written A; B Writing code that requires A to be executed before B *and* requires that the whole thing act like a single expression is much more rare. >> then I doubt it will be something that users will >> be expected to read and/or edit. In which case, again, it doesn't >> matter how ugly the syntax is. "__exprSequencer" would do just fine. > > Making D metaprogramming spectacularly ugly will not help bring metaprogramming to the mainstream and will drive away the kind of people who can create fantastic metaprogramming applications. Then pick something less ugly! Double colon is still free in D isn't it? My point of arguing this is just that I'm still hoping commas could be used to make a tuple literal syntax. And now Andrei is going to jump in and say "why do we need that? We want to fish not eat fish, lookee I've made a fish hook for you, it's spelled: "Tuple!()"" or somthing like that. P.S. making compile-time reflection spectacularly ugly is also not a good way to bring metaprogramming to the mainstream. (Looking at you, __traits). P.P.S. on the other hand, Python uses double underscores all over the place and people call it a beautiful language. Go figure. I guess it's only ugly till you have a few dozen of them. Then it's a "pattern". --bb | |||
July 11, 2009 Re: Case Range Statement .. | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Bill Baxter | Bill Baxter wrote:
> P.P.S. on the other hand, Python uses double underscores all over the
> place and people call it a beautiful language. Go figure. I guess
> it's only ugly till you have a few dozen of them. Then it's a
> "pattern".
Maybe Python has a community that knows better what to worry about :o).
Andrei
| |||
July 11, 2009 Re: Case Range Statement .. | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Bill Baxter | Hello Bill,
> P.P.S. on the other hand, Python uses double underscores all over the
> place and people call it a beautiful language. Go figure. I guess
> it's only ugly till you have a few dozen of them. Then it's a
> "pattern".
>
> --bb
>
"A single double underscore is a tragedy; a million double underscores is a statistic"
-- Jo Stuff Stall'em
| |||
July 11, 2009 Re: Number literals (Was: Re: Case Range Statement ..) | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | Andrei Alexandrescu wrote:
> Anyhow... it would be a bummer if the negative atmosphere as of late in the group would cause people like you just lose interest. I can't understand what's going on.
I think it would help if you weren't so condescending to people all the time. People don't like that much.
| |||
July 11, 2009 Re: Case Range Statement .. | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | On Fri, Jul 10, 2009 at 6:08 PM, Andrei Alexandrescu<SeeWebsiteForEmail@erdani.org> wrote: > Bill Baxter wrote: >> >> P.P.S. on the other hand, Python uses double underscores all over the place and people call it a beautiful language. Go figure. I guess it's only ugly till you have a few dozen of them. Then it's a "pattern". > > Maybe Python has a community that knows better what to worry about :o). I think it's more that it has a strong leadership. --bb | |||
July 11, 2009 Re: Number literals (Was: Re: Case Range Statement ..) | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Benji Smith | Benji Smith wrote:
> Andrei Alexandrescu wrote:
>> Anyhow... it would be a bummer if the negative atmosphere as of late in the group would cause people like you just lose interest. I can't understand what's going on.
>
> I think it would help if you weren't so condescending to people all the time. People don't like that much.
I understand. My perception is that negativity predates my being condescending, which roots from exasperation. For every annoying message of mine there are dozens patient messages making a similar point. But you're right, if a point is made the wrong way its correctness is not that relevant anymore.
Andrei
| |||
July 11, 2009 Re: Case Range Statement .. | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | I think that inclusive ranges more intuitive for beginner programmers because statements: case 1..10, array [1..10], foreach (int item; 1..10), foreach_reverse (int item; 1..10) (now foreach_reverse range is too dificult to understand it: item begins with 10 or 9, ends 1 or 2?) will not require an explanation of their actions. Thanks. | |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply