November 07, 2012 Re: [ ArgumentList ] vs. @( ArgumentList ) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Timon Gehr | On 11/7/2012 2:12 AM, Timon Gehr wrote:
> On 11/07/2012 09:28 AM, Simen Kjaeraas wrote:
>> On 2012-19-07 09:11, John Chapman <johnch_atms@hotmail.com> wrote:
>>
>>> Personally, I also like <ArgumentList>.
>>
>> I am glad to say this will not happen. <> as delimiters cause problems
>> because they're used elsewhere as non-matching:
>>
>> <MyAttribute(foo > bar)>
>>
>
> This example does not show that they cause problems.
< 3, 4>7 >
does.
|
November 07, 2012 Re: [ ArgumentList ] vs. @( ArgumentList ) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jonas Drewsen | On 11/7/2012 11:40 AM, Jonas Drewsen wrote:
> I we were to allow for @foobar style UDA then "safe" would have to be a reserved
> keyword somehow. Otherwise I do not know what this would mean:
>
> struct safe { }
> @safe void foobar() { }
Yes, I agree this is a significant problem.
|
November 07, 2012 Re: [ ArgumentList ] vs. @( ArgumentList ) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | Le 07/11/2012 21:24, Walter Bright a écrit :
> On 11/7/2012 11:40 AM, Jonas Drewsen wrote:
>> I we were to allow for @foobar style UDA then "safe" would have to be
>> a reserved
>> keyword somehow. Otherwise I do not know what this would mean:
>>
>> struct safe { }
>> @safe void foobar() { }
>
> Yes, I agree this is a significant problem.
>
As a cross topic answer, I'll mention that allowing anything to be an attribute is likely to be a bad idea, and that way to solve that are already discussed.
|
November 07, 2012 Re: [ ArgumentList ] vs. @( ArgumentList ) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | On 11/07/2012 09:20 PM, Walter Bright wrote:
> On 11/7/2012 9:00 AM, Timon Gehr wrote:
>> On 11/06/2012 08:18 PM, Walter Bright wrote:
>>>
>>> @( ArgumentList )
>>>
>>> ...
>>
>> I do not like that one as I already use the syntax.
>
> That currently isn't accepted by the D compiler - what are you already
> using it for?
Text interpolation.
enum d = "c";
mixin(X!"abc@(d)ef"); // -> abccef
I use it mostly for code generation.
mixin(mixin(X!q{
if(@(a)) @(b);
}));
|
November 07, 2012 Re: [ ArgumentList ] vs. @( ArgumentList ) | ||||
---|---|---|---|---|
| ||||
Posted in reply to John Chapman | On 2012-11-07, 18:03, John Chapman wrote: > On Wednesday, 7 November 2012 at 11:29:16 UTC, Simen Kjaeraas wrote: >> On 2012-12-07 11:11, Timon Gehr <timon.gehr@gmx.ch> wrote: >> >>> On 11/07/2012 09:28 AM, Simen Kjaeraas wrote: >>>> On 2012-19-07 09:11, John Chapman <johnch_atms@hotmail.com> wrote: >>>> >>>>> Personally, I also like <ArgumentList>. >>>> >>>> I am glad to say this will not happen. <> as delimiters cause problems >>>> because they're used elsewhere as non-matching: >>>> >>>> <MyAttribute(foo > bar)> >>>> >>> >>> This example does not show that they cause problems. >> >> Not true. The compiler certainly can handle it, but a programmer could >> easily be confused. > > I'm not putting it forward for consideration, but there is a precedent in Visual Basic - http://msdn.microsoft.com/en-US/library/h3z05kek%28v=vs.80%29.aspx I think that's the first time I've heard someone suggest something be borrowed from VB. :p -- Simen |
November 07, 2012 Re: [ ArgumentList ] vs. @( ArgumentList ) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jacob Carlborg | On Wed, 07 Nov 2012 19:17:20 +0100
Jacob Carlborg <doob@me.com> wrote:
> On 2012-11-07 16:51, Nick Sabalausky wrote:
>
> > vote++
> >
> > It has all the benefits of '@(...)' (which are very compelling on
> > their own), but also has the *ONE* benefit of '[...]': Much less
> > getting lost in stupid parenthesis, as demonstrated here:
> > http://forum.dlang.org/thread/k7afq6$2832$1@digitalmars.com?page=14#post-puseurlcwbgvigwkdowu:40forum.dlang.org
>
> This is how that example would look like with my syntax:
>
> http://pastebin.com/8Ve5KS49
>
> I think it looks better in most cases
>
Well, I'm in favor of the @attr shortcut regardless of @[] vs @().
|
November 07, 2012 Re: [ ArgumentList ] vs. @( ArgumentList ) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Simen Kjaeraas | On 11/7/2012 1:30 PM, Simen Kjaeraas wrote:
> I think that's the first time I've heard someone suggest something be
> borrowed from VB. :p
Of course we all take it for granted that Basic sux and does everything wrong, and this has been going on for 30+ years. But in one of the early design sessions on D, I'd ask "Since Basic sux, why is its string handling so nice & convenient, and C's string handling is such a misery?"
So Basic did provide some motivation.
|
November 07, 2012 Re: [ ArgumentList ] vs. @( ArgumentList ) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Timon Gehr | On 11/7/2012 1:16 PM, Timon Gehr wrote:
> Text interpolation.
>
> enum d = "c";
>
> mixin(X!"abc@(d)ef"); // -> abccef
>
> I use it mostly for code generation.
>
> mixin(mixin(X!q{
> if(@(a)) @(b);
> }));
I see. How hard would it be to change it?
|
November 07, 2012 Re: [ ArgumentList ] vs. @( ArgumentList ) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | On 11/07/2012 11:42 PM, Walter Bright wrote:
> On 11/7/2012 1:16 PM, Timon Gehr wrote:
>> Text interpolation.
>>
>> enum d = "c";
>>
>> mixin(X!"abc@(d)ef"); // -> abccef
>>
>> I use it mostly for code generation.
>>
>> mixin(mixin(X!q{
>> if(@(a)) @(b);
>> }));
>
> I see. How hard would it be to change it?
Not too hard, it can probably be automated.
I do not have issues with fixing up my code after breaking changes.
Even without this consideration, I still prefer
@[a,b,c]
|
November 07, 2012 Re: [ ArgumentList ] vs. @( ArgumentList ) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Timon Gehr | Le 07/11/2012 22:16, Timon Gehr a écrit :
> On 11/07/2012 09:20 PM, Walter Bright wrote:
>> On 11/7/2012 9:00 AM, Timon Gehr wrote:
>>> On 11/06/2012 08:18 PM, Walter Bright wrote:
>>>>
>>>> @( ArgumentList )
>>>>
>>>> ...
>>>
>>> I do not like that one as I already use the syntax.
>>
>> That currently isn't accepted by the D compiler - what are you already
>> using it for?
>
> Text interpolation.
>
> enum d = "c";
>
> mixin(X!"abc@(d)ef"); // -> abccef
>
> I use it mostly for code generation.
>
> mixin(mixin(X!q{
> if(@(a)) @(b);
> }));
This can happen with any syntax addition. I usually use really bizantine stuff when I do that (like <{@a@}>) so I'm sure to avoid the issue.
Can't a convention be decided on that ?
|
Copyright © 1999-2021 by the D Language Foundation