digitalmars.D - [ ArgumentList ] vs. ( ArgumentList )
- Walter Bright (20/20) Nov 06 2012 For User Defined Attributes.
- David Nadlinger (7/9) Nov 06 2012 Actually, I find it even nicer looking than the other syntax.
- deadalnix (3/23) Nov 06 2012 BTW, I'm all for @argument @argument @argument rather than @(argumentlis...
- r_m_r (2/22) Nov 06 2012
- Benjamin Thaut (7/27) Nov 06 2012 I think @( ArgumentList ) would be more consistent with what D already
- ponce (2/2) Nov 06 2012 I like @(ArgumentList) better for stated reason: it looks like
- Manu (10/12) Nov 06 2012 I actually quite liked Tristan's argument.
- deadalnix (2/15) Nov 06 2012
- Jesse Phillips (6/23) Nov 06 2012 If you want, you can take some history into consideration. This
- Simen Kjaeraas (4/24) Nov 06 2012 @( ArgumentList ).
- David Nadlinger (4/7) Nov 06 2012 I guess »precedent with Java« should be added to the respective
- deadalnix (2/10) Nov 06 2012 And python. By themselves, they represent a much bigger user base than C...
- Jacob Carlborg (5/25) Nov 06 2012 I vote for @( ArgumentList ). If this is syntax chosen I also hope
- Manu (4/39) Nov 06 2012 I'd like to re-enforce the consideration that @attribute() makes it look...
- Jacob Carlborg (4/7) Nov 06 2012 I still like the syntax.
- Manu (2/8) Nov 06 2012 I liked it initially too, but reason changed my mind...
- foobar (13/20) Nov 06 2012 I'd also like to add that the OP argument is false.
- Jacob Carlborg (5/8) Nov 06 2012 Then we just have to make it possible to generate code with these
- deadalnix (2/8) Nov 06 2012 That seems the most reasonable option.
- David Nadlinger (10/15) Nov 06 2012 Why would @ look like that to you? Actually, @ seems to yell
- Paulo Pinto (6/36) Nov 07 2012 Speaking from C# point of view, the same argument can be used, because
- Damian (6/26) Nov 06 2012 At first I liked the C# style, but it just does not mix well
- mist (2/2) Nov 06 2012 Vote for "@( ArgumentList )"
- Brian Schott (2/4) Nov 06 2012 I'd argue that this is important.
- Faux Amis (2/22) Nov 06 2012 With [] I expect array operations; can I slice it?
- Simen Kjaeraas (4/35) Nov 06 2012 Of course. It's a typetuple.
- Manu (4/36) Nov 06 2012 this is a really good point. they are a tuple, you can slice it, iterate
- David Nadlinger (3/7) Nov 06 2012 Not really – [] represents an array, not a tuple.
- Andrej Mitrovic (5/6) Nov 06 2012 I vote for @.
- Max Samukha (2/22) Nov 06 2012 @() with optional ().
- Matt Soucy (3/23) Nov 06 2012 One more vote for @( ArgumentList ) with optional () for simple ones -
- captaindet (2/22) Nov 06 2012
- H. S. Teoh (12/12) Nov 06 2012 I vote for @(ArgumentList).
- =?ISO-8859-1?Q?S=F6nke_Ludwig?= (5/5) Nov 06 2012 I agree with David and deadalnix agument wise, so:
- =?UTF-8?B?QWxpIMOHZWhyZWxp?= (3/4) Nov 06 2012 @() with optional ().
- Tavi Cacina (2/3) Nov 06 2012 @
- deadalnix (2/5) Nov 06 2012 Who will make that even shorter ?
- =?UTF-8?B?QWxpIMOHZWhyZWxp?= (4/12) Nov 06 2012 Not shorter but definitely more in line with C and C++ heritage:
- Tavi Cacina (4/4) Nov 06 2012 I must add that watching the mind game from Chris
- Walter Bright (2/5) Nov 06 2012 2 penalty points for that one!
- Jacob Carlborg (4/10) Nov 07 2012 The @( ArgumentList ) syntax still wins :)
- Jonathan M Davis (7/8) Nov 06 2012 Definitely @(ArgumentList). It fits with what other languages do, and it...
- deadalnix (2/9) Nov 06 2012 Can you explain that code breakage ?
- Walter Bright (4/15) Nov 06 2012 C++11 has had problems adding new keywords, as about every identifier so...
- deadalnix (3/23) Nov 06 2012 OK I understand. This is fixable easily by adding thoses magic attribute...
- Jonathan M Davis (18/42) Nov 06 2012 It would still break code, because then there would be a conflict which ...
- deadalnix (3/45) Nov 06 2012 As you stated, this is true for ANY identifier, so I don't see why this
- Jonathan M Davis (5/7) Nov 06 2012 Because it sucks, and being able to avoid having that problem spread is ...
- Andrej Mitrovic (5/7) Nov 06 2012 I really doubt we're going to create any new language properties
- Andrej Mitrovic (23/30) Nov 06 2012 Actually, let me give you a better argument.
- Jacob Carlborg (9/13) Nov 07 2012 Just create a new attribute, call it "builtin" or something similar,
- foobar (26/40) Nov 07 2012 I honestly don't get why we keep reinventing the concept of
- Iain Buclaw (9/32) Nov 07 2012 y
- Caligo (7/8) Nov 06 2012 If those are our only choices, then I vote for @( ArgumentList ).
- Walter Bright (2/11) Nov 06 2012 :-)
- =?UTF-8?B?QWxpIMOHZWhyZWxp?= (4/21) Nov 06 2012 More explicitly:
- Jacob Carlborg (4/9) Nov 07 2012 These are just horrible.
- deadalnix (2/14) Nov 07 2012 I think that was joke :D
- Jacob Carlborg (4/5) Nov 07 2012 You never can be too certain when it comes to syntax suggestions :)
- alex (1/1) Nov 06 2012 @
- H. S. Teoh (5/19) Nov 06 2012 They look like smileys to me. To me, they look worse than @Arg.
- Artur Skawina (9/17) Nov 06 2012 Easy - do not introduce any new *global* built-in attributes, ever. Ther...
- Nick Sabalausky (7/10) Nov 07 2012 vote++
- Regan Heath (9/19) Nov 07 2012 I hadn't replied to this thread earlier because I didn't have a strong
- Alex_Dovhal (2/20) Nov 07 2012 +1
- Jacob Carlborg (6/11) Nov 07 2012 This is how that example would look like with my syntax:
- Regan Heath (10/20) Nov 07 2012 For comparison the same again using @[]:
- H. S. Teoh (8/33) Nov 07 2012 [...]
- Tobias Pankrath (10/22) Nov 07 2012 I like Jacobs proposal more. On many keyboards are [ and ]
- deadalnix (2/4) Nov 07 2012 As long as SURPRISE feature are added to master, that is not gonna happe...
- Nick Sabalausky (3/18) Nov 07 2012 Well, I'm in favor of the @attr shortcut regardless of @[] vs @().
- Jonathan M Davis (8/20) Nov 06 2012 That's not really acceptable IMHO. Not being able to add new attributes ...
- deadalnix (2/22) Nov 06 2012 Language attribute can be added in object.d and regular lookup rule appl...
- David Nadlinger (8/10) Nov 06 2012 Well, the same could be said about language keywords as well, or
- kraybourne (4/4) Nov 06 2012 @(Attr...) and @attr1 @attr2
- Andrei Alexandrescu (4/7) Nov 06 2012 Sure you mean
- kraybourne (2/5) Nov 07 2012 Mind = blown :)
- Jonathan M Davis (3/15) Nov 06 2012 That seems like a pretty good argument.
- Artur Skawina (18/38) Nov 06 2012 What I'm saying is that any new "built-in" attributes (and there *will* ...
- Jakob Ovrum (12/13) Nov 06 2012 I think that [] is sufficiently distinct from built-in
- Jakob Ovrum (3/5) Nov 06 2012 This is quite bad for a variety of reasons, I'll change my vote
- H. S. Teoh (6/11) Nov 07 2012 I still prefer @(), for being easier to type on a variety of keyboards.
- John Chapman (10/19) Nov 07 2012 @ArgumentList makes me think I'm on Twitter. #joke
- Simen Kjaeraas (6/7) Nov 07 2012 I am glad to say this will not happen. <> as delimiters cause problems
- Timon Gehr (2/7) Nov 07 2012 This example does not show that they cause problems.
- Simen Kjaeraas (5/16) Nov 07 2012 Not true. The compiler certainly can handle it, but a programmer could
- John Chapman (5/23) Nov 07 2012 I'm not putting it forward for consideration, but there is a
- Simen Kjaeraas (5/26) Nov 07 2012 I think that's the first time I've heard someone suggest something be
- Walter Bright (6/8) Nov 07 2012 Of course we all take it for granted that Basic sux and does everything ...
- Nick Sabalausky (3/6) Nov 07 2012 Which Basic? ;) (<-- Just as one example)
- Walter Bright (2/8) Nov 07 2012 All of them!
- Walter Bright (3/14) Nov 07 2012 < 3, 4>7 >
- Marco Leise (7/13) Nov 07 2012 That adds to the user base, but it is possible that in both
- John Chapman (2/13) Nov 07 2012 Actually, C# got there first, Delphi not until 2010.
- Nathan M. Swan (14/34) Nov 07 2012 [], because @ should be reserved for future language keywords.
- deadalnix (5/48) Nov 07 2012 I think D has already too many feature, and that many of them can be
- Jacob Carlborg (4/8) Nov 07 2012 I completely agree.
- Marco Leise (14/23) Nov 07 2012 Which features are that? It would likely require a major
- Jacob Carlborg (8/18) Nov 08 2012 "synchronized" is another that I think would be easy to do with AST
- Dmitry Olshansky (5/26) Nov 08 2012 +1
- Nick Sabalausky (8/15) Nov 08 2012 Doesn't that still amount to the same amount of features though? At
- Nick Sabalausky (10/17) Nov 08 2012 Also, these particular sorts of things (compile time processing of
- Dmitry Olshansky (11/28) Nov 08 2012 If we finally get to the usual byte-code interpreter then it is more the...
- deadalnix (19/34) Nov 09 2012 It have several advantages.
- Jonas Drewsen (9/9) Nov 07 2012 My vote goes to @(a,b,c) and @a @b @c.
- Jonathan M Davis (13/24) Nov 07 2012 It mainly came down to not wanting to add new keywords. By using @safe i...
- Jacob Carlborg (4/12) Nov 07 2012 And then we would suddenly have Objective-C :(
- Jonas Drewsen (8/45) Nov 07 2012 I we were to allow for @foobar style UDA then "safe" would have
- Walter Bright (2/6) Nov 07 2012 Yes, I agree this is a significant problem.
- deadalnix (4/12) Nov 07 2012 As a cross topic answer, I'll mention that allowing anything to be an
- Andrei Alexandrescu (5/13) Nov 07 2012 I think it's solvable. The basic approach would be to plop types "safe",...
- David Nadlinger (5/8) Nov 07 2012 "nothrow" isn't actually an @attribute. So much for the value of
- Andrej Mitrovic (4/8) Nov 07 2012 Another classic inconsistency:
- deadalnix (3/11) Nov 09 2012 Good new for you, with the given proposal, you'll be able to do
- Simen Kjaeraas (5/19) Nov 09 2012 Or even:
- Walter Bright (10/23) Nov 07 2012 Consider that if we do that, then someone will need to disambiguate with...
- =?UTF-8?B?U8O2bmtlIEx1ZHdpZw==?= (5/38) Nov 08 2012 In that case $(object.safe) would be required - the shortcut then only
- Jacob Carlborg (10/19) Nov 08 2012 I would say:
- deadalnix (12/37) Nov 09 2012 How didn't see that coming. I never was a big fan of .identifier syntax
- Jonas Drewsen (17/32) Nov 08 2012 The original argument that the @ in front of @safe is a way to
- Tobias Pankrath (2/36) Nov 08 2012 Not safe but @safe should become a keyword.
- deadalnix (4/35) Nov 09 2012 nothrow is already a keyword (which is really inconsistent). I'm not
- Marco Leise (13/16) Nov 10 2012 That requires that the compiler exposes all sorts of
- =?ISO-8859-1?Q?S=F6nke_Ludwig?= (11/28) Nov 10 2012 Not duplicated, but moved - which results in a simpler compiler
- Jacob Carlborg (4/8) Nov 08 2012 The current attributes are keywords from a user/developer point view.
- Dejan Lekic (4/24) Nov 07 2012 I prefer the @(list) syntax because we already have @attributes
- Timon Gehr (2/4) Nov 07 2012 I do not like that one as I already use the syntax.
- Walter Bright (2/8) Nov 07 2012 That currently isn't accepted by the D compiler - what are you already u...
- Timon Gehr (8/18) Nov 07 2012 Text interpolation.
- Walter Bright (2/9) Nov 07 2012 I see. How hard would it be to change it?
- Timon Gehr (5/18) Nov 07 2012 Not too hard, it can probably be automated.
- deadalnix (4/23) Nov 07 2012 This can happen with any syntax addition. I usually use really bizantine...
- Jacob Carlborg (4/11) Nov 08 2012 This is what we need AST macros for.
- Paulo Pinto (4/24) Nov 07 2012 Already too late to the party. I join my voice to the @() group.
- F i L (7/7) Nov 07 2012 @(attribute) looks prettier to me, and with the other pros I
- deadalnix (4/24) Nov 07 2012 About @() vs @[] the key point to me is that this is consistent with
- nazriel (4/24) Nov 07 2012 @() with required ().
- deadalnix (2/34) Nov 07 2012 Language attribute must die :D
For User Defined Attributes. In the north corner we have the current champeeeeon: ------- [ ArgumentList ] Pros: looks nice Cons: not so greppable parsing ambiguity with [array literal].func(); ------ In the south corner, there's the chaaaaallenger: ( ArgumentList ) Pros: looks like existing attribute syntax no parsing problems Cons: not as nice looking ------ No hitting below the belt! Let the games begin!
Nov 06 2012
On Tuesday, 6 November 2012 at 19:18:39 UTC, Walter Bright wrote:( ArgumentList ) not as nice lookingActually, I find it even nicer looking than the other syntax. Combine it with allowing the omission of the parens for a single argument and allowing multiple specifications of it per declaration, and it starts to look a whole lot like the built-in attributes. David
Nov 06 2012
Le 06/11/2012 20:18, Walter Bright a écrit :For User Defined Attributes. In the north corner we have the current champeeeeon: ------- [ ArgumentList ] Pros: looks nice Cons: not so greppable parsing ambiguity with [array literal].func(); ------ In the south corner, there's the chaaaaallenger: ( ArgumentList ) Pros: looks like existing attribute syntax no parsing problemsLook like what is done in Java, python and PHP.Cons: not as nice looking ------ No hitting below the belt! Let the games begin!BTW, I'm all for argument argument argument rather than (argumentlist)
Nov 06 2012
( ArgumentList ) FTW :D On Tuesday, 6 November 2012 at 19:18:39 UTC, Walter Bright wrote:For User Defined Attributes. In the north corner we have the current champeeeeon: ------- [ ArgumentList ] Pros: looks nice Cons: not so greppable parsing ambiguity with [array literal].func(); ------ In the south corner, there's the chaaaaallenger: ( ArgumentList ) Pros: looks like existing attribute syntax no parsing problems Cons: not as nice looking ------ No hitting below the belt! Let the games begin!
Nov 06 2012
Am 06.11.2012 20:18, schrieb Walter Bright:For User Defined Attributes. In the north corner we have the current champeeeeon: ------- [ ArgumentList ] Pros: looks nice Cons: not so greppable parsing ambiguity with [array literal].func(); ------ In the south corner, there's the chaaaaallenger: ( ArgumentList ) Pros: looks like existing attribute syntax no parsing problems Cons: not as nice looking ------ No hitting below the belt! Let the games begin!I think ( ArgumentList ) would be more consistent with what D already has, but my vot still goes for [ ArgumentList ] because personally I find that 's make the code look "ugly". There are other languages where the ' ' is only used for language features you shouldn't be using a lot. Kind Regards Benjamin Thaut
Nov 06 2012
I like (ArgumentList) better for stated reason: it looks like existing attributes.
Nov 06 2012
I actually quite liked Tristan's argument. [attr, attr2] feels more like what it is, an annotation. It does nothing, has no effect on the declaration on its own. the attr syntax looks like existing attributes, and with that kinda comes the presumption that they actually DO something, affect the code generated in some way. For that reason, I buy the argument that [attrs...] being visually distinct makes more sense, more like what it is. Perhaps it should be termed 'annotation' rather than 'attribute'? On 6 November 2012 21:38, ponce <spam spam.org> wrote:I like (ArgumentList) better for stated reason: it looks like existing attributes.
Nov 06 2012
Le 06/11/2012 20:47, Manu a écrit :I actually quite liked Tristan's argument. [attr, attr2] feels more like what it is, an annotation. It does nothing, has no effect on the declaration on its own. the attr syntax looks like existing attributes, and with that kinda comes the presumption that they actually DO something, affect the code generated in some way.This is definitively what they should do at some point.For that reason, I buy the argument that [attrs...] being visually distinct makes more sense, more like what it is. Perhaps it should be termed 'annotation' rather than 'attribute'? On 6 November 2012 21:38, ponce <spam spam.org <mailto:spam spam.org>> wrote: I like (ArgumentList) better for stated reason: it looks like existing attributes.
Nov 06 2012
On Tuesday, 6 November 2012 at 19:47:57 UTC, Manu wrote:I actually quite liked Tristan's argument. [attr, attr2] feels more like what it is, an annotation. It does nothing, has no effect on the declaration on its own. the attr syntax looks like existing attributes, and with that kinda comes the presumption that they actually DO something, affect the code generated in some way. For that reason, I buy the argument that [attrs...] being visually distinct makes more sense, more like what it is. Perhaps it should be termed 'annotation' rather than 'attribute'? On 6 November 2012 21:38, ponce <spam spam.org> wrote:If you want, you can take some history into consideration. This DIP is the reason for the property/ safe syntax http://www.prowiki.org/wiki4d/wiki.cgi?LanguageDevel/DIPs/DIP6 Maybe not that specific page, but it comes from the big annotation discussions.I like (ArgumentList) better for stated reason: it looks like existing attributes.
Nov 06 2012
On 2012-11-06, 20:18, Walter Bright wrote:For User Defined Attributes. In the north corner we have the current champeeeeon: ------- [ ArgumentList ] Pros: looks nice Cons: not so greppable parsing ambiguity with [array literal].func(); ------ In the south corner, there's the chaaaaallenger: ( ArgumentList ) Pros: looks like existing attribute syntax no parsing problems Cons: not as nice looking ------ No hitting below the belt! Let the games begin!( ArgumentList ). -- Simen
Nov 06 2012
On Tuesday, 6 November 2012 at 19:18:39 UTC, Walter Bright wrote:[ ArgumentList ] Pros:I guess »precedent with Java« should be added to the respective () list then. David
Nov 06 2012
Le 06/11/2012 20:46, David Nadlinger a écrit :On Tuesday, 6 November 2012 at 19:18:39 UTC, Walter Bright wrote:[ ArgumentList ] Pros:I guess »precedent with Java« should be added to the respective () list then. David
Nov 06 2012
On 2012-11-06 20:18, Walter Bright wrote:For User Defined Attributes. In the north corner we have the current champeeeeon: ------- [ ArgumentList ] Pros: looks nice Cons: not so greppable parsing ambiguity with [array literal].func(); ------ In the south corner, there's the chaaaaallenger: ( ArgumentList ) Pros: looks like existing attribute syntax no parsing problems Cons: not as nice looking ------ No hitting below the belt! Let the games begin!I vote for ( ArgumentList ). If this is syntax chosen I also hope attribute will be legal as well. -- /Jacob Carlborg
Nov 06 2012
I'd like to re-enforce the consideration that attribute() makes it looks like they affect the code generation somehow... they're really just annotations. On 6 November 2012 21:47, Jacob Carlborg <doob me.com> wrote:On 2012-11-06 20:18, Walter Bright wrote:For User Defined Attributes. In the north corner we have the current champeeeeon: ------- [ ArgumentList ] Pros: looks nice Cons: not so greppable parsing ambiguity with [array literal].func(); ------ In the south corner, there's the chaaaaallenger: ( ArgumentList ) Pros: looks like existing attribute syntax no parsing problems Cons: not as nice looking ------ No hitting below the belt! Let the games begin!I vote for ( ArgumentList ). If this is syntax chosen I also hope attribute will be legal as well. -- /Jacob Carlborg
Nov 06 2012
On 2012-11-06 20:52, Manu wrote:I'd like to re-enforce the consideration that attribute() makes it looks like they affect the code generation somehow... they're really just annotations.I still like the syntax. -- /Jacob Carlborg
Nov 06 2012
On 6 November 2012 22:01, Jacob Carlborg <doob me.com> wrote:On 2012-11-06 20:52, Manu wrote:I liked it initially too, but reason changed my mind...I'd like to re-enforce the consideration that attribute() makes it looks like they affect the code generation somehow... they're really just annotations.I still like the syntax.
Nov 06 2012
On Tuesday, 6 November 2012 at 20:01:27 UTC, Jacob Carlborg wrote:On 2012-11-06 20:52, Manu wrote:I'd also like to add that the OP argument is false. Sure, the attributes themselves are just meta-data and you can use them for purely informative purposes (to annotate with documentation, author names, versions, license, etc..) but more commonly attributes are intended to be introspected on at CT or RT and used to *indirectly cause some processing*. The end result is the same and user defined attributes should be consistent with built-in ones. to the eye than the Java one but given the possible grammar ambiguities and the consistency with buit-ins, (attributes) win by a landslide.I'd like to re-enforce the consideration that attribute() makes it looks like they affect the code generation somehow... they're really just annotations.I still like the syntax.
Nov 06 2012
On 2012-11-06 20:52, Manu wrote:I'd like to re-enforce the consideration that attribute() makes it looks like they affect the code generation somehow... they're really just annotations.Then we just have to make it possible to generate code with these attributes :) -- /Jacob Carlborg
Nov 06 2012
Le 06/11/2012 21:17, Jacob Carlborg a écrit :On 2012-11-06 20:52, Manu wrote:That seems the most reasonable option.I'd like to re-enforce the consideration that attribute() makes it looks like they affect the code generation somehow... they're really just annotations.Then we just have to make it possible to generate code with these attributes :)
Nov 06 2012
On Tuesday, 6 November 2012 at 19:52:45 UTC, Manu wrote:I'd like to re-enforce the consideration that attribute() makes it looks like they affect the code generation somehow... they're really just annotations.Why would look like that to you? Actually, seems to yell »annotation« to me, probably because of my (limited) exposure to Python. And don't forget that UDAs _do_ in practice have an effect on code generation, at least a lot more than safe-ty attributes. Whether the mechanism by which they gain that effect is built into the compiler or implemented in a library doesn't matter to the user of a library. David
Nov 06 2012
Am 06.11.2012 20:52, schrieb Manu:I'd like to re-enforce the consideration that attribute() makes it looks like they affect the code generation somehow... they're really just annotations. On 6 November 2012 21:47, Jacob Carlborg <doob me.com <mailto:doob me.com>> wrote: On 2012-11-06 20:18, Walter Bright wrote: For User Defined Attributes. In the north corner we have the current champeeeeon: ------- [ ArgumentList ] Pros: looks nice Cons: not so greppable parsing ambiguity with [array literal].func(); ------ In the south corner, there's the chaaaaallenger: ( ArgumentList ) Pros: looks like existing attribute syntax no parsing problems Cons: not as nice looking ------ No hitting below the belt! Let the games begin! I vote for ( ArgumentList ). If this is syntax chosen I also hope attribute will be legal as well. -- /Jacob Carlborgin .NET [] attributes might change the way the code gets generated. Some of them like are even reckognized by the JIT/NGEN. -- Paulo
Nov 07 2012
On Tuesday, 6 November 2012 at 19:18:39 UTC, Walter Bright wrote:For User Defined Attributes. In the north corner we have the current champeeeeon: ------- [ ArgumentList ] Pros: looks nice Cons: not so greppable parsing ambiguity with [array literal].func(); ------ In the south corner, there's the chaaaaallenger: ( ArgumentList ) Pros: looks like existing attribute syntax no parsing problems Cons: not as nice looking ------ No hitting below the belt! Let the games begin!with D's system attributes. So my vote is for.. ( ArgumentList ) I would prefer if I could enclose system and user attributes in the parenthesis, with no idea how that would work though.
Nov 06 2012
Vote for " ( ArgumentList )" Mostly because of current and yet possible ambiguity issue.
Nov 06 2012
On Tuesday, 6 November 2012 at 19:18:39 UTC, Walter Bright wrote:Cons: not so greppableI'd argue that this is important.
Nov 06 2012
On 06/11/2012 20:18, Walter Bright wrote:For User Defined Attributes. In the north corner we have the current champeeeeon: ------- [ ArgumentList ] Pros: looks nice Cons: not so greppable parsing ambiguity with [array literal].func(); ------ In the south corner, there's the chaaaaallenger: ( ArgumentList ) Pros: looks like existing attribute syntax no parsing problems Cons: not as nice looking ------ No hitting below the belt! Let the games begin!With [] I expect array operations; can I slice it?
Nov 06 2012
On 2012-11-06, 20:55, Faux Amis wrote:On 06/11/2012 20:18, Walter Bright wrote:Of course. It's a typetuple. -- SimenFor User Defined Attributes. In the north corner we have the current champeeeeon: ------- [ ArgumentList ] Pros: looks nice Cons: not so greppable parsing ambiguity with [array literal].func(); ------ In the south corner, there's the chaaaaallenger: ( ArgumentList ) Pros: looks like existing attribute syntax no parsing problems Cons: not as nice looking ------ No hitting below the belt! Let the games begin!With [] I expect array operations; can I slice it?
Nov 06 2012
On 6 November 2012 21:55, Faux Amis <faux amis.com> wrote:On 06/11/2012 20:18, Walter Bright wrote:this is a really good point. they are a tuple, you can slice it, iterate it... further supports [] to my mind ;)For User Defined Attributes. In the north corner we have the current champeeeeon: ------- [ ArgumentList ] Pros: looks nice Cons: not so greppable parsing ambiguity with [array literal].func(); ------ In the south corner, there's the chaaaaallenger: ( ArgumentList ) Pros: looks like existing attribute syntax no parsing problems Cons: not as nice looking ------ No hitting below the belt! Let the games begin!With [] I expect array operations; can I slice it?
Nov 06 2012
On Tuesday, 6 November 2012 at 20:13:32 UTC, Manu wrote:this is a really good point. they are a tuple, you can slice it, iterate it... further supports [] to my mind ;)Not really – [] represents an array, not a tuple. David
Nov 06 2012
On 11/6/12, Walter Bright <newshound2 digitalmars.com> wrote:( ArgumentList )I vote for . We have both arrays, static arrays, and hashes which use the [] syntax. And we have a precedent for with property functions and other attributes (e.g. disable).
Nov 06 2012
On Tuesday, 6 November 2012 at 19:18:39 UTC, Walter Bright wrote:For User Defined Attributes. In the north corner we have the current champeeeeon: ------- [ ArgumentList ] Pros: looks nice Cons: not so greppable parsing ambiguity with [array literal].func(); ------ In the south corner, there's the chaaaaallenger: ( ArgumentList ) Pros: looks like existing attribute syntax no parsing problems Cons: not as nice looking ------ No hitting below the belt! Let the games begin!() with optional ().
Nov 06 2012
On 11/06/2012 02:18 PM, Walter Bright wrote:For User Defined Attributes. In the north corner we have the current champeeeeon: ------- [ ArgumentList ] Pros: looks nice Cons: not so greppable parsing ambiguity with [array literal].func(); ------ In the south corner, there's the chaaaaallenger: ( ArgumentList ) Pros: looks like existing attribute syntax no parsing problems Cons: not as nice looking ------ No hitting below the belt! Let the games begin!One more vote for ( ArgumentList ) with optional () for simple ones - they seem like they would fit with the rest of the language much more nicely
Nov 06 2012
( ArgumentList ) is the winner for me. On 2012-11-06 13:18, Walter Bright wrote:For User Defined Attributes. In the north corner we have the current champeeeeon: ------- [ ArgumentList ] Pros: looks nice Cons: not so greppable parsing ambiguity with [array literal].func(); ------ In the south corner, there's the chaaaaallenger: ( ArgumentList ) Pros: looks like existing attribute syntax no parsing problems Cons: not as nice looking ------ No hitting below the belt! Let the games begin!
Nov 06 2012
I vote for (ArgumentList). Or Arg1 Arg2 ... as somebody mentioned. It's more consistent with existing -syntax. Reusing [] is bad because it visually conflicts with array literals (and makes parsing harder to boot). is a unique symbol that, so far, is associated with attributes, so it makes sense to use it also to mark user-defined attributes. I don't buy the argument that other languages have a different syntax. We're talking about D here, and what is chosen should make sense in the context of D, without undue influence from other languages. T -- If the comments and the code disagree, it's likely that *both* are wrong. -- Christopher
Nov 06 2012
I agree with David and deadalnix agument wise, so: (attriblist) or attrib1 attrib2 with the hope that this syntax is extensible enough to make it possible to implement something like safe or noheap as library functionality at some day.
Nov 06 2012
On 11/06/2012 11:18 AM, Walter Bright wrote:For User Defined Attributes.() with optional (). Ali
Nov 06 2012
On Tuesday, 6 November 2012 at 19:18:39 UTC, Walter Bright wrote:No hitting below the belt! Let the games begin!
Nov 06 2012
Le 06/11/2012 22:07, Tavi Cacina a écrit :On Tuesday, 6 November 2012 at 19:18:39 UTC, Walter Bright wrote:Who will make that even shorter ?No hitting below the belt! Let the games begin!
Nov 06 2012
On 11/06/2012 01:19 PM, deadalnix wrote:Le 06/11/2012 22:07, Tavi Cacina a écrit :Not shorter but definitely more in line with C and C++ heritage: static() with optional () AliOn Tuesday, 6 November 2012 at 19:18:39 UTC, Walter Bright wrote:Who will make that even shorter ?No hitting below the belt! Let the games begin!
Nov 06 2012
I must add that watching the mind game from Chris http://forum.dlang.org/post/puseurlcwbgvigwkdowu forum.dlang.org the [] is quite appealing. The is perfect if one needs just a singular tag. Is having both not an option :-)
Nov 06 2012
On 11/6/2012 1:07 PM, Tavi Cacina wrote:On Tuesday, 6 November 2012 at 19:18:39 UTC, Walter Bright wrote:2 penalty points for that one!No hitting below the belt! Let the games begin!
Nov 06 2012
On 2012-11-06 22:38, Walter Bright wrote:On 11/6/2012 1:07 PM, Tavi Cacina wrote:The ( ArgumentList ) syntax still wins :) -- /Jacob CarlborgOn Tuesday, 6 November 2012 at 19:18:39 UTC, Walter Bright wrote:2 penalty points for that one!No hitting below the belt! Let the games begin!
Nov 07 2012
On Tuesday, November 06, 2012 11:18:34 Walter Bright wrote:No hitting below the belt! Let the games begin!Definitely (ArgumentList). It fits with what other languages do, and it matches what we're already doing for attributes. I also think that's what pretty much everyone was figuring would be used for user-defined attributes. The only major problem would be if ArgumentList is allowed when there's only a single argument, then code could break when new built-in attributes are added. - Jonathan M Davis
Nov 06 2012
Le 06/11/2012 22:02, Jonathan M Davis a écrit :On Tuesday, November 06, 2012 11:18:34 Walter Bright wrote:Can you explain that code breakage ?No hitting below the belt! Let the games begin!Definitely (ArgumentList). It fits with what other languages do, and it matches what we're already doing for attributes. I also think that's what pretty much everyone was figuring would be used for user-defined attributes. The only major problem would be if ArgumentList is allowed when there's only a single argument, then code could break when new built-in attributes are added.
Nov 06 2012
On 11/6/2012 1:41 PM, deadalnix wrote:Le 06/11/2012 22:02, Jonathan M Davis a écrit :C++11 has had problems adding new keywords, as about every identifier somewhere has been used by someone's C++ source code, and they don't want to break existing code. So C++11 winds up with awful things like "decltype".On Tuesday, November 06, 2012 11:18:34 Walter Bright wrote:Can you explain that code breakage ?No hitting below the belt! Let the games begin!Definitely (ArgumentList). It fits with what other languages do, and it matches what we're already doing for attributes. I also think that's what pretty much everyone was figuring would be used for user-defined attributes. The only major problem would be if ArgumentList is allowed when there's only a single argument, then code could break when new built-in attributes are added.
Nov 06 2012
Le 06/11/2012 22:53, Walter Bright a écrit :On 11/6/2012 1:41 PM, deadalnix wrote:OK I understand. This is fixable easily by adding thoses magic attribute in object and using regular lookup rules.Le 06/11/2012 22:02, Jonathan M Davis a écrit :C++11 has had problems adding new keywords, as about every identifier somewhere has been used by someone's C++ source code, and they don't want to break existing code. So C++11 winds up with awful things like "decltype".On Tuesday, November 06, 2012 11:18:34 Walter Bright wrote:Can you explain that code breakage ?No hitting below the belt! Let the games begin!Definitely (ArgumentList). It fits with what other languages do, and it matches what we're already doing for attributes. I also think that's what pretty much everyone was figuring would be used for user-defined attributes. The only major problem would be if ArgumentList is allowed when there's only a single argument, then code could break when new built-in attributes are added.
Nov 06 2012
On Tuesday, November 06, 2012 23:26:28 deadalnix wrote:Le 06/11/2012 22:53, Walter Bright a écrit :It would still break code, because then there would be a conflict which would have to be resolved. It's the same as if we were to do something like add a function to std.file called find. Anything importing both std.algorithm and std.file would break (assuming that the arguments matched both). To some extent, this is unavoidable. Adding _any_ function to a library risks breaking user code if there's any other function that it uses which has the same name and similar enough arguments. That's what we get for automatically inferring which function and requiring the full path for disambiguation rather than requiring the full path unless a specific command makes it so that it's unnecessary (e.g. aliasing std.algorithm.find to find). So, if we want to avoid breaking code when adding new built-in attributes, we're going to have to define custom attributes in a way which they can't ever conflict with built-in ones - which would probably mean making customAttribute illegal and require (customAttribute). But if we're willing to break user code when adding a new attribute, forcing user code to change its attribute names or give their full path, then we can allow customAttribute. - Jonathan M DavisOn 11/6/2012 1:41 PM, deadalnix wrote:OK I understand. This is fixable easily by adding thoses magic attribute in object and using regular lookup rules.Le 06/11/2012 22:02, Jonathan M Davis a écrit :C++11 has had problems adding new keywords, as about every identifier somewhere has been used by someone's C++ source code, and they don't want to break existing code. So C++11 winds up with awful things like "decltype".On Tuesday, November 06, 2012 11:18:34 Walter Bright wrote:Can you explain that code breakage ?No hitting below the belt! Let the games begin!Definitely (ArgumentList). It fits with what other languages do, and it matches what we're already doing for attributes. I also think that's what pretty much everyone was figuring would be used for user-defined attributes. The only major problem would be if ArgumentList is allowed when there's only a single argument, then code could break when new built-in attributes are added.
Nov 06 2012
Le 07/11/2012 00:29, Jonathan M Davis a écrit :On Tuesday, November 06, 2012 23:26:28 deadalnix wrote:As you stated, this is true for ANY identifier, so I don't see why this pop in this particular discussion.Le 06/11/2012 22:53, Walter Bright a écrit :It would still break code, because then there would be a conflict which would have to be resolved. It's the same as if we were to do something like add a function to std.file called find. Anything importing both std.algorithm and std.file would break (assuming that the arguments matched both). To some extent, this is unavoidable. Adding _any_ function to a library risks breaking user code if there's any other function that it uses which has the same name and similar enough arguments. That's what we get for automatically inferring which function and requiring the full path for disambiguation rather than requiring the full path unless a specific command makes it so that it's unnecessary (e.g. aliasing std.algorithm.find to find). So, if we want to avoid breaking code when adding new built-in attributes, we're going to have to define custom attributes in a way which they can't ever conflict with built-in ones - which would probably mean making customAttribute illegal and require (customAttribute). But if we're willing to break user code when adding a new attribute, forcing user code to change its attribute names or give their full path, then we can allow customAttribute. - Jonathan M DavisOn 11/6/2012 1:41 PM, deadalnix wrote:OK I understand. This is fixable easily by adding thoses magic attribute in object and using regular lookup rules.Le 06/11/2012 22:02, Jonathan M Davis a écrit :C++11 has had problems adding new keywords, as about every identifier somewhere has been used by someone's C++ source code, and they don't want to break existing code. So C++11 winds up with awful things like "decltype".On Tuesday, November 06, 2012 11:18:34 Walter Bright wrote:Can you explain that code breakage ?No hitting below the belt! Let the games begin!Definitely (ArgumentList). It fits with what other languages do, and it matches what we're already doing for attributes. I also think that's what pretty much everyone was figuring would be used for user-defined attributes. The only major problem would be if ArgumentList is allowed when there's only a single argument, then code could break when new built-in attributes are added.
Nov 06 2012
On Wednesday, November 07, 2012 02:07:53 deadalnix wrote:As you stated, this is true for ANY identifier, so I don't see why this pop in this particular discussion.Because it sucks, and being able to avoid having that problem spread is a good thing. Just because something is a problem in one place doesn't mean that it's okay to have that same problem somewhere else. - Jonathan M Davis
Nov 06 2012
On 11/7/12, Jonathan M Davis <jmdavisProg gmx.com> wrote:It would still break code, because then there would be a conflict which would have to be resolved.I really doubt we're going to create any new language properties (you're the only one I can see suggesting this). And if we are, we should use special identifiers that begin with underscores. In any case, we can always use an alias to resolve conflicts.
Nov 06 2012
On 11/7/12, Andrej Mitrovic <andrej.mitrovich gmail.com> wrote:On 11/7/12, Jonathan M Davis <jmdavisProg gmx.com> wrote:Actually, let me give you a better argument. Let's say you implement your own (NoGC) attribute that you use in your own library. You use it like so: (NoGC) class Foo { } And somewhere down the road 5 months from now druntime introduces it's own NoGC attribute. Personally I would rather have a compile-time error due to clashing symbol names right then and there. Otherwise I could easily end up in a situation where I **forget** to parenthesize my custom NoGC attribute and end up using the druntime one: (NoGC) class Foo { } NoGC class Bar { } // oops, I meant (NoGC) I really don't think we should have parenthesis dictate name lookup, it's way too easy to screw things up like that. Let the symbols clash so I can fix the problem with the already existing alias tools in D: alias mymod.NoGC MyNoGC; (MyNoGC) class Foo { } MyNoGC class Bar { } or simply: (mymod.NoGC) class Foo { } mymod.NoGC class Bar { } Then I can be at ease knowing I'm not accidentally using one attribute or the other because of an issue with missing parens.It would still break code, because then there would be a conflict which would have to be resolved.I really doubt we're going to create any new language properties (you're the only one I can see suggesting this). And if we are, we should use special identifiers that begin with underscores. In any case, we can always use an alias to resolve conflicts.
Nov 06 2012
On 2012-11-06 22:53, Walter Bright wrote:C++11 has had problems adding new keywords, as about every identifier somewhere has been used by someone's C++ source code, and they don't want to break existing code. So C++11 winds up with awful things like "decltype".Just create a new attribute, call it "builtin" or something similar, which takes attributes as arguments, i.e. builtin(shared) int a; builtin(property) int b; I'm not suggesting that we should change the existing shared and property, I just used them as an example. -- /Jacob Carlborg
Nov 07 2012
On Wednesday, 7 November 2012 at 08:36:49 UTC, Jacob Carlborg wrote:On 2012-11-06 22:53, Walter Bright wrote:I honestly don't get why we keep reinventing the concept of namespaces. I agree with Jonathan regarding the identifier look-up rules in D. "std.algorithm.find" really should be *the default* unless the user specifically aliases that to "find" whereas now we have the exact opposite. But even without this we still should use D's already existing namespace solution - *the module system*. We should take a lesson from other platforms such as Java and .NET where everything is neatly organized. Let's stop this global identifiers nightmare! On that note, here's some things we *should not do*: - put unrelated random stuff in object.d - add more redundant ways to define namespaces such as __identifier, builtin(identifier), attribute(identifier), identifier, etc, etc.. - add more keywords because they conflict with global identifiers. - have _huge_ single modules in Phobos that contain everything and ythe kitchen sink. I still hate with passion the "std.algorithm" "module". It's like opening a shop called "A Shop" or naming a newspaper "Newspaper". Proper organization is not inherently evil and we should not complicate the language design to compensate our current sloppiness.C++11 has had problems adding new keywords, as about every identifier somewhere has been used by someone's C++ source code, and they don't want to break existing code. So C++11 winds up with awful things like "decltype".Just create a new attribute, call it "builtin" or something similar, which takes attributes as arguments, i.e. builtin(shared) int a; builtin(property) int b; I'm not suggesting that we should change the existing shared and property, I just used them as an example.
Nov 07 2012
On 6 November 2012 21:53, Walter Bright <newshound2 digitalmars.com> wrote:On 11/6/2012 1:41 PM, deadalnix wrote:tLe 06/11/2012 22:02, Jonathan M Davis a =E9crit :On Tuesday, November 06, 2012 11:18:34 Walter Bright wrote:No hitting below the belt! Let the games begin!Definitely (ArgumentList). It fits with what other languages do, and i=ymatches what we're already doing for attributes. I also think that's what prett=lymuch everyone was figuring would be used for user-defined attributes. The on=toC++11 has had problems adding new keywords, as about every identifier somewhere has been used by someone's C++ source code, and they don't want=major problem would be if ArgumentList is allowed when there's only a single argument, then code could break when new built-in attributes are added.Can you explain that code breakage ?break existing code. So C++11 winds up with awful things like "decltype".*cough* _Static_Assert *cough* --=20 Iain Buclaw *(p < e ? p++ : p) =3D (c & 0x0f) + '0';
Nov 07 2012
On Tue, Nov 6, 2012 at 1:18 PM, Walter Bright <newshound2 digitalmars.com> wrote:No hitting below the belt! Let the games begin!If those are our only choices, then I vote for ( ArgumentList ). Otherwise, I think these look better: [: ArgumentList :] or |: ArgumentList :|
Nov 06 2012
On 11/6/2012 1:26 PM, Caligo wrote:On Tue, Nov 6, 2012 at 1:18 PM, Walter Bright <newshound2 digitalmars.com> wrote::-)No hitting below the belt! Let the games begin!If those are our only choices, then I vote for ( ArgumentList ). Otherwise, I think these look better: [: ArgumentList :] or |: ArgumentList :|
Nov 06 2012
On 11/06/2012 01:39 PM, Walter Bright wrote:On 11/6/2012 1:26 PM, Caligo wrote:More explicitly: (-: ArgumentList :-) AliOn Tue, Nov 6, 2012 at 1:18 PM, Walter Bright <newshound2 digitalmars.com> wrote::-)No hitting below the belt! Let the games begin!If those are our only choices, then I vote for ( ArgumentList ). Otherwise, I think these look better: [: ArgumentList :] or |: ArgumentList :|
Nov 06 2012
On 2012-11-06 22:26, Caligo wrote:If those are our only choices, then I vote for ( ArgumentList ). Otherwise, I think these look better: [: ArgumentList :] or |: ArgumentList :|These are just horrible. -- /Jacob Carlborg
Nov 07 2012
Le 07/11/2012 09:37, Jacob Carlborg a écrit :On 2012-11-06 22:26, Caligo wrote:I think that was joke :DIf those are our only choices, then I vote for ( ArgumentList ). Otherwise, I think these look better: [: ArgumentList :] or |: ArgumentList :|These are just horrible.
Nov 07 2012
On 2012-11-07 14:36, deadalnix wrote:I think that was joke :DYou never can be too certain when it comes to syntax suggestions :) -- /Jacob Carlborg
Nov 07 2012
On Tue, Nov 06, 2012 at 03:26:53PM -0600, Caligo wrote:On Tue, Nov 6, 2012 at 1:18 PM, Walter Bright <newshound2 digitalmars.com> wrote:They look like smileys to me. To me, they look worse than Arg. T -- Once bitten, twice cry...No hitting below the belt! Let the games begin!If those are our only choices, then I vote for ( ArgumentList ). Otherwise, I think these look better: [: ArgumentList :] or |: ArgumentList :|
Nov 06 2012
On 11/06/12 22:02, Jonathan M Davis wrote:On Tuesday, November 06, 2012 11:18:34 Walter Bright wrote:Easy - do not introduce any new *global* built-in attributes, ever. There's no reason why they all can't use the same look-up rules. As to the syntax - it doesn't matter, as long as it isn't "[ArgumentList]" as that one is ambiguous (from a programmer POV, even if the compiler could deal with it - which i'm not convinced is the case here, considering all contexts where attributes have to be allowed and the inevitable evolution of this feature). " [ArgumentList]". arturNo hitting below the belt! Let the games begin!Definitely (ArgumentList). It fits with what other languages do, and it matches what we're already doing for attributes. I also think that's what pretty much everyone was figuring would be used for user-defined attributes. The only major problem would be if ArgumentList is allowed when there's only a single argument, then code could break when new built-in attributes are added.
Nov 06 2012
On Tue, 06 Nov 2012 22:53:36 +0100 Artur Skawina <art.08.09 gmail.com> wrote:" [ArgumentList]".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
Nov 07 2012
On Wed, 07 Nov 2012 15:51:50 -0000, Nick Sabalausky <SeeWebsiteToContactMe semitwist.com> wrote:On Tue, 06 Nov 2012 22:53:36 +0100 Artur Skawina <art.08.09 gmail.com> wrote:I hadn't replied to this thread earlier because I didn't have a strong opinion either way, but, this suggestion appears to be the best of both worlds. So.. vote++ R -- Using Opera's revolutionary email client: http://www.opera.com/mail/" [ArgumentList]".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
Nov 07 2012
"Regan Heath" <regan netmail.co.nz> wroteOn Wed, 07 Nov 2012 15:51:50 -0000, Nick Sabalausky <SeeWebsiteToContactMe semitwist.com> wrote:+1On Tue, 06 Nov 2012 22:53:36 +0100 Artur Skawina <art.08.09 gmail.com> wrote:I hadn't replied to this thread earlier because I didn't have a strong opinion either way, but, this suggestion appears to be the best of both worlds. So.. vote++" [ArgumentList]".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
Nov 07 2012
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.orgThis is how that example would look like with my syntax: http://pastebin.com/8Ve5KS49 I think it looks better in most cases -- /Jacob Carlborg
Nov 07 2012
On Wed, 07 Nov 2012 18:17:20 -0000, Jacob Carlborg <doob me.com> wrote:On 2012-11-07 16:51, Nick Sabalausky wrote:For comparison the same again using []: http://pastebin.com/vgjLSXMv I actually think the pastebin syntax highlighting makes both of them look worse (why the horrid green!). Here it is with no highlighting: http://pastebin.com/08judqWj R -- Using Opera's revolutionary email client: http://www.opera.com/mail/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.orgThis is how that example would look like with my syntax: http://pastebin.com/8Ve5KS49 I think it looks better in most cases
Nov 07 2012
On Wed, Nov 07, 2012 at 06:28:54PM -0000, Regan Heath wrote:On Wed, 07 Nov 2012 18:17:20 -0000, Jacob Carlborg <doob me.com> wrote:[...] Hmm. Having seen both () and [] in actual sample code, I have to say that () is visually less distracting and more pleasant to read (to me, anyway, YMMV). I don't like [] because it just stands out too much. T -- "I'm running Windows '98." "Yes." "My computer isn't working now." "Yes, you already said that." -- User-FriendlyOn 2012-11-07 16:51, Nick Sabalausky wrote:For comparison the same again using []: http://pastebin.com/vgjLSXMv I actually think the pastebin syntax highlighting makes both of them look worse (why the horrid green!). Here it is with no highlighting: http://pastebin.com/08judqWjvote++ 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.orgThis is how that example would look like with my syntax: http://pastebin.com/8Ve5KS49 I think it looks better in most cases
Nov 07 2012
On Wednesday, 7 November 2012 at 18:28:54 UTC, Regan Heath wrote:I like Jacobs proposal more. On many keyboards are [ and ] notoriously hard to type . Despite that: please make any form of brackets optional. I wouldn't consider any possibly breaking changes in the future for two reasons: First: New buildin UDA can go into modules and adhere to normal scoping rules. Second: When the time comes, we'll hopefully have enough reengineering tools that can fully qualify any conflicting uses of a name automatically.This is how that example would look like with my syntax: http://pastebin.com/8Ve5KS49 I think it looks better in most casesFor comparison the same again using []: http://pastebin.com/vgjLSXMv I actually think the pastebin syntax highlighting makes both of them look worse (why the horrid green!). Here it is with no highlighting: http://pastebin.com/08judqWj R
Nov 07 2012
Le 07/11/2012 19:44, Tobias Pankrath a écrit :Second: When the time comes, we'll hopefully have enough reengineering tools that can fully qualify any conflicting uses of a name automatically.As long as SURPRISE feature are added to master, that is not gonna happen.
Nov 07 2012
On Wed, 07 Nov 2012 19:17:20 +0100 Jacob Carlborg <doob me.com> wrote:On 2012-11-07 16:51, Nick Sabalausky wrote:Well, I'm in favor of the attr shortcut regardless of [] vs ().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.orgThis is how that example would look like with my syntax: http://pastebin.com/8Ve5KS49 I think it looks better in most cases
Nov 07 2012
On Tuesday, November 06, 2012 22:53:36 Artur Skawina wrote:On 11/06/12 22:02, Jonathan M Davis wrote:That's not really acceptable IMHO. Not being able to add new attributes to the language itself in the future is way too restrictive, and I expect that we'll come up with more that we want to add eventually. Designing custom attributes in a way that is guaranteed to conflict with that is a bad idea. We're restricting ourselves and causing problems for ourselves later when we could easily avoid doing so. - Jonathan M DavisOn Tuesday, November 06, 2012 11:18:34 Walter Bright wrote:Easy - do not introduce any new *global* built-in attributes, ever. There's no reason why they all can't use the same look-up rules.No hitting below the belt! Let the games begin!Definitely (ArgumentList). It fits with what other languages do, and it matches what we're already doing for attributes. I also think that's what pretty much everyone was figuring would be used for user-defined attributes. The only major problem would be if ArgumentList is allowed when there's only a single argument, then code could break when new built-in attributes are added.
Nov 06 2012
Le 07/11/2012 00:21, Jonathan M Davis a écrit :On Tuesday, November 06, 2012 22:53:36 Artur Skawina wrote:Language attribute can be added in object.d and regular lookup rule apply.On 11/06/12 22:02, Jonathan M Davis wrote:That's not really acceptable IMHO. Not being able to add new attributes to the language itself in the future is way too restrictive, and I expect that we'll come up with more that we want to add eventually. Designing custom attributes in a way that is guaranteed to conflict with that is a bad idea. We're restricting ourselves and causing problems for ourselves later when we could easily avoid doing so. - Jonathan M DavisOn Tuesday, November 06, 2012 11:18:34 Walter Bright wrote:Easy - do not introduce any new *global* built-in attributes, ever. There's no reason why they all can't use the same look-up rules.No hitting below the belt! Let the games begin!Definitely (ArgumentList). It fits with what other languages do, and it matches what we're already doing for attributes. I also think that's what pretty much everyone was figuring would be used for user-defined attributes. The only major problem would be if ArgumentList is allowed when there's only a single argument, then code could break when new built-in attributes are added.
Nov 06 2012
On Tuesday, 6 November 2012 at 23:23:47 UTC, Jonathan M Davis wrote:Designing custom attributes in a way that is guaranteed to conflict with that is a bad idea.Well, the same could be said about language keywords as well, or really just adding names in general. I don't see a good reason why special contortions for user defined annotations should be required, if simply adding a name to Phobos (even a private one!) can have just the same effect. David
Nov 06 2012
(Attr...) and attr1 attr2 Because I secretly dream about stuff like: alias (nothrow,safe,memoizable) memosafe; memosafe int foo(){...}
Nov 06 2012
On 11/7/12 2:27 AM, kraybourne wrote:(Attr...) and attr1 attr2 Because I secretly dream about stuff like: alias (nothrow,safe,memoizable) memosafe;Sure you mean alias memosafe = (nothrow,safe,memoizable); Andrei
Nov 06 2012
On 11/7/12 03:48 , Andrei Alexandrescu wrote:Sure you mean alias memosafe = (nothrow,safe,memoizable); AndreiMind = blown :)
Nov 07 2012
On Wednesday, November 07, 2012 00:58:47 Andrej Mitrovic wrote:Actually, let me give you a better argument. Let's say you implement your own (NoGC) attribute that you use in your own library. You use it like so: (NoGC) class Foo { } And somewhere down the road 5 months from now druntime introduces it's own NoGC attribute. Personally I would rather have a compile-time error due to clashing symbol names right then and there. Otherwise I could easily end up in a situation where I **forget** to parenthesize my custom NoGC attribute and end up using the druntime one:That seems like a pretty good argument. - Jonathan M Davis
Nov 06 2012
On 11/07/12 00:21, Jonathan M Davis wrote:On Tuesday, November 06, 2012 22:53:36 Artur Skawina wrote:What I'm saying is that any new "built-in" attributes (and there *will* be many of these) can have their own namespace. Yeah, it could make the code a little more verbose, but it makes several problems go away. Eg import attr = core.attr; // Could be implicit, ie in object.d. int f() [attr.pure, attr.deprecated("Use something else"), attr.inline] {return 42;} I said attr.pure, but migrating the existing built-ins is not worth the cost, at least not until other language changes happen. The above is too verbose? Then int f() attr[pure, deprecated("Use something else"), inline] {return 42;} is possible (which works just as the above - looks for the named attributes in the "attr" scope). Almost as terse as the current approach, but more powerful. And not as bad as context sensitive keywords (which would be another way to reduce collisions with other user-defined identifiers w/o resorting to pragmas, strings, etc). arturOn 11/06/12 22:02, Jonathan M Davis wrote:That's not really acceptable IMHO. Not being able to add new attributes to the language itself in the future is way too restrictive, and I expect that we'll come up with more that we want to add eventually. Designing custom attributes in a way that is guaranteed to conflict with that is a bad idea. We're restricting ourselves and causing problems for ourselves later when we could easily avoid doing so.On Tuesday, November 06, 2012 11:18:34 Walter Bright wrote:Easy - do not introduce any new *global* built-in attributes, ever. There's no reason why they all can't use the same look-up rules.No hitting below the belt! Let the games begin!Definitely (ArgumentList). It fits with what other languages do, and it matches what we're already doing for attributes. I also think that's what pretty much everyone was figuring would be used for user-defined attributes. The only major problem would be if ArgumentList is allowed when there's only a single argument, then code could break when new built-in attributes are added.
Nov 06 2012
On Tuesday, 6 November 2012 at 19:18:39 UTC, Walter Bright wrote:No hitting below the belt! Let the games begin!I think that [] is sufficiently distinct from built-in attributes, unlike (), but sadly, there's no nice way to parse it at statement scope. There are in fact a couple of ambiguous cases in the parser already; let's not introduce any more, lest we lose the ability to call D easy to parse. (foo) looks too similar to built-in attributes. And let's face it; these annotations are actually quite different (I too prefer the more accurate name, 'annotations') from built-in attributes, the former cannot replace the latter any time soon. I want to hear what people think about [] at declaration scope and [] at statement scope. Too complicated to remember?
Nov 06 2012
On Wednesday, 7 November 2012 at 05:53:35 UTC, Jakob Ovrum wrote:I want to hear what people think about [] at declaration scope and [] at statement scope. Too complicated to remember?This is quite bad for a variety of reasons, I'll change my vote for purely having [] then.
Nov 06 2012
On Wed, Nov 07, 2012 at 06:57:10AM +0100, Jakob Ovrum wrote:On Wednesday, 7 November 2012 at 05:53:35 UTC, Jakob Ovrum wrote:Inconsistent. I don't like it.I want to hear what people think about [] at declaration scope and [] at statement scope. Too complicated to remember?This is quite bad for a variety of reasons, I'll change my vote for purely having [] then.I still prefer (), for being easier to type on a variety of keyboards. T -- "Hi." "'Lo."
Nov 07 2012
[ ArgumentList ] Pros:And Delphi.( ArgumentList ) Pros: looks like existing attribute syntax no parsing problems Cons: not as nice lookingArgumentList makes me think I'm on Twitter. #joke Personally, I also like <ArgumentList>. Prior to property and family being introduced, I'd have gone with [ArgumentList]. But since is the prefix for attributes in D, let's stick with it for UDAs. And as to any clashes between UDAs and possible future built-in ones, I'd say the language has first dibs on names and it's up to people writing UDAs to avoid using names that sound like language constructs.
Nov 07 2012
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)> -- Simen
Nov 07 2012
On 11/07/2012 09:28 AM, Simen Kjaeraas wrote:On 2012-19-07 09:11, John Chapman <johnch_atms hotmail.com> wrote:This example does not show that they cause problems.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)>
Nov 07 2012
On 2012-12-07 11:11, Timon Gehr <timon.gehr gmx.ch> wrote:On 11/07/2012 09:28 AM, Simen Kjaeraas wrote:Not true. The compiler certainly can handle it, but a programmer could easily be confused. -- SimenOn 2012-19-07 09:11, John Chapman <johnch_atms hotmail.com> wrote:This example does not show that they cause problems.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)>
Nov 07 2012
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: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.aspxOn 11/07/2012 09:28 AM, Simen Kjaeraas wrote:Not true. The compiler certainly can handle it, but a programmer could easily be confused.On 2012-19-07 09:11, John Chapman <johnch_atms hotmail.com> wrote:This example does not show that they cause problems.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)>
Nov 07 2012
On 2012-11-07, 18:03, John Chapman wrote:On Wednesday, 7 November 2012 at 11:29:16 UTC, Simen Kjaeraas wrote:I think that's the first time I've heard someone suggest something be borrowed from VB. :p -- SimenOn 2012-12-07 11:11, Timon Gehr <timon.gehr gmx.ch> wrote: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.aspxOn 11/07/2012 09:28 AM, Simen Kjaeraas wrote:Not true. The compiler certainly can handle it, but a programmer could easily be confused.On 2012-19-07 09:11, John Chapman <johnch_atms hotmail.com> wrote:This example does not show that they cause problems.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)>
Nov 07 2012
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. :pOf 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.
Nov 07 2012
On Wed, 07 Nov 2012 14:40:33 -0800 Walter Bright <newshound2 digitalmars.com> wrote:Of course we all take it for granted that Basic sux and does everything wrong,Which Basic? ;) (<-- Just as one example)
Nov 07 2012
On 11/7/2012 10:32 PM, Nick Sabalausky wrote:On Wed, 07 Nov 2012 14:40:33 -0800 Walter Bright <newshound2 digitalmars.com> wrote:All of them!Of course we all take it for granted that Basic sux and does everything wrong,Which Basic? ;) (<-- Just as one example)
Nov 07 2012
On 11/7/2012 2:12 AM, Timon Gehr wrote:On 11/07/2012 09:28 AM, Simen Kjaeraas wrote:< 3, 4>7 > does.On 2012-19-07 09:11, John Chapman <johnch_atms hotmail.com> wrote:This example does not show that they cause problems.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)>
Nov 07 2012
Am Wed, 07 Nov 2012 09:19:41 +0100 schrieb "John Chapman" <johnch_atms hotmail.com>:That adds to the user base, but it is possible that in both cases Anders Hejlsberg was responsible for the design -- Marco[ ArgumentList ] Pros:And Delphi.
Nov 07 2012
On Wednesday, 7 November 2012 at 16:55:23 UTC, Marco Leise wrote:Am Wed, 07 Nov 2012 09:19:41 +0100 schrieb "John Chapman" <johnch_atms hotmail.com>:That adds to the user base, but it is possible that in both cases Anders Hejlsberg was responsible for the design[ ArgumentList ] Pros:And Delphi.
Nov 07 2012
On 11/06/2012 10:18 AM, Walter Bright wrote:For User Defined Attributes. In the north corner we have the current champeeeeon: ------- [ ArgumentList ] Pros: looks nice Cons: not so greppable parsing ambiguity with [array literal].func(); ------ In the south corner, there's the chaaaaallenger: ( ArgumentList ) Pros: looks like existing attribute syntax no parsing problems Cons: not as nice looking ------ No hitting below the belt! Let the games begin![], because should be reserved for future language keywords. Whenever people post suggested language features that require some marking, they introduce a new attribute, because introducing a plain keyword breaks code. If you have UDAs, this further limits language expansion. Example: let's say you want to introduce a "nogc" mark: 1. Not a nogc keyword, that could break "bool nogc;" 2. If you have , nogc could break an "enum nogc;" attribute. 3. Now you're stuck with __nogc or #nogc or something uglier. There is a familiar-to-other-langauges advantage to , but there is a better-than-other-languages advantage to []. My thoughts, NMS
Nov 07 2012
Le 07/11/2012 09:32, Nathan M. Swan a écrit :On 11/06/2012 10:18 AM, Walter Bright wrote:I think D has already too many feature, and that many of them can be implemented as attribute + AST processing. D should work toward getting this AST stuff and stop adding new keywords all the time.For User Defined Attributes. In the north corner we have the current champeeeeon: ------- [ ArgumentList ] Pros: looks nice Cons: not so greppable parsing ambiguity with [array literal].func(); ------ In the south corner, there's the chaaaaallenger: ( ArgumentList ) Pros: looks like existing attribute syntax no parsing problems Cons: not as nice looking ------ No hitting below the belt! Let the games begin![], because should be reserved for future language keywords. Whenever people post suggested language features that require some marking, they introduce a new attribute, because introducing a plain keyword breaks code. If you have UDAs, this further limits language expansion. Example: let's say you want to introduce a "nogc" mark: 1. Not a nogc keyword, that could break "bool nogc;" 2. If you have , nogc could break an "enum nogc;" attribute. 3. Now you're stuck with __nogc or #nogc or something uglier. There is a familiar-to-other-langauges advantage to , but there is a better-than-other-languages advantage to []. My thoughts, NMS
Nov 07 2012
On 2012-11-07 14:40, deadalnix wrote:I think D has already too many feature, and that many of them can be implemented as attribute + AST processing. D should work toward getting this AST stuff and stop adding new keywords all the time.I completely agree. -- /Jacob Carlborg
Nov 07 2012
Am Wed, 07 Nov 2012 16:19:56 +0100 schrieb Jacob Carlborg <doob me.com>:On 2012-11-07 14:40, deadalnix wrote:Which features are that? It would likely require a major rewrite of many routines. Who would want to go through all that and the following wave of bugs - some of which may have already occurred in the past. foreach and scope(...) lowerings are essentially AST operations. Are there other D features you would implement as AST processing, maybe a link to an earlier post ? How close is Rust currently to offering flexible AST manipulation for lowerings/attributes/macros, does anyone know ? -- MarcoI think D has already too many feature, and that many of them can be implemented as attribute + AST processing. D should work toward getting this AST stuff and stop adding new keywords all the time.I completely agree.
Nov 07 2012
On 2012-11-08 04:34, Marco Leise wrote:Which features are that? It would likely require a major rewrite of many routines. Who would want to go through all that and the following wave of bugs - some of which may have already occurred in the past. foreach and scope(...) lowerings are essentially AST operations. Are there other D features you would implement as AST processing, maybe a link to an earlier post ?"synchronized" is another that I think would be easy to do with AST macros. Perhaps "with". It's probably not worth replacing existing language features with macros just for the sake of it. But for future features AST macros could perhaps be used instead.How close is Rust currently to offering flexible AST manipulation for lowerings/attributes/macros, does anyone know ?I have no idea. I haven't looked at Rust in this area. -- /Jacob Carlborg
Nov 08 2012
11/7/2012 5:40 PM, deadalnix пишет: [snip]+1[], because should be reserved for future language keywords. Whenever people post suggested language features that require some marking, they introduce a new attribute, because introducing a plain keyword breaks code. If you have UDAs, this further limits language expansion. Example: let's say you want to introduce a "nogc" mark: 1. Not a nogc keyword, that could break "bool nogc;" 2. If you have , nogc could break an "enum nogc;" attribute. 3. Now you're stuck with __nogc or #nogc or something uglier. There is a familiar-to-other-langauges advantage to , but there is a better-than-other-languages advantage to []. My thoughts, NMSI think D has already too many feature, and that many of them can be implemented as attribute + AST processing.D should work toward getting this AST stuff and stop adding new keywords all the time.-- Dmitry Olshansky
Nov 08 2012
On Thu, 08 Nov 2012 21:53:11 +0400 Dmitry Olshansky <dmitry.olsh gmail.com> wrote:11/7/2012 5:40 PM, deadalnix =D0=BF=D0=B8=D1=88=D0=B5=D1=82:Doesn't that still amount to the same amount of features though? At least from the user's standpoint anyway. Plus, I would imagine that library-implemented features would be slower to compile (simply because it's just that much more to be compiled). Not that I'm necessarily saying "Always stuff everything into the language forever!" I just don't see it as quite so clear-cut.I think D has already too many feature, and that many of them can be implemented as attribute + AST processing.=20 +1 =20
Nov 08 2012
On Thu, 8 Nov 2012 14:27:14 -0500 Nick Sabalausky <SeeWebsiteToContactMe semitwist.com> wrote:[...]Plus, I would imagine that library-implemented features would be slower to compile (simply because it's just that much more to be compiled).Also, these particular sorts of things (compile time processing of things that are in-library) essentially amount to executing interpreted code to compile. Sure, that's very powerful, and very well worth having, but should it really be done for very common features? For common features, I'd imagine native non-"interpreted" support would help compilation speed, which is one of D's major goals and benefits. Suddenly interpreting large parts of the language might work against that.Not that I'm necessarily saying "Always stuff everything into the language forever!" I just don't see it as quite so clear-cut.
Nov 08 2012
11/8/2012 11:34 PM, Nick Sabalausky пишет:On Thu, 8 Nov 2012 14:27:14 -0500 Nick Sabalausky <SeeWebsiteToContactMe semitwist.com> wrote:If we finally get to the usual byte-code interpreter then it is more the sufficiently fast to do trivial re-writes that features like synchronized are all about. Anyway I'm not for trying to redo all (if any) of the built-in stuff. If it's bug free and works, fine let it be. We can't remove it anyway. I just anticipate a couple more features to crop up if UDA dropping from nowhere is any indicator. And then another tiny most useful thing, and another one, and ...[...]Plus, I would imagine that library-implemented features would be slower to compile (simply because it's just that much more to be compiled).Also, these particular sorts of things (compile time processing of things that are in-library) essentially amount to executing interpreted code to compile. Sure, that's very powerful, and very well worth having, but should it really be done for very common features? For common features, I'd imagine native non-"interpreted" support would help compilation speed, which is one of D's major goals and benefits. Suddenly interpreting large parts of the language might work against that.-- Dmitry OlshanskyNot that I'm necessarily saying "Always stuff everything into the language forever!" I just don't see it as quite so clear-cut.
Nov 08 2012
Le 08/11/2012 20:27, Nick Sabalausky a écrit :On Thu, 08 Nov 2012 21:53:11 +0400 Dmitry Olshansky<dmitry.olsh gmail.com> wrote:It have several advantages. It is easy to test a feature as a lib, and then include it later in the standard lib if it does make sense. This is a great improvement as it don't require hacking the compiler. This allow many people to play around with the feature they like without breaking the language in many pieces. As before, successful features can be included. Implementing a feature don't require anymore to know the compiler internal, and do not require either to know other feature internals. A new feature in compiler A is available in other compiler as well at the same time. Same goes for tooling around the language. Now, it is almost impossible to provide proper tooling around D because new feature are dropped into dmd master quite often and all tools have to be updated (most people give up at some point). As of speed, some people, including me but I'm not the only one, are working toward JIT compile for CTFE. With some bytecode caching, I'm pretty sure really good performance can be achieved (unless the feature's implementation suck badly).11/7/2012 5:40 PM, deadalnix пишет:Doesn't that still amount to the same amount of features though? At least from the user's standpoint anyway. Plus, I would imagine that library-implemented features would be slower to compile (simply because it's just that much more to be compiled). Not that I'm necessarily saying "Always stuff everything into the language forever!" I just don't see it as quite so clear-cut.I think D has already too many feature, and that many of them can be implemented as attribute + AST processing.+1
Nov 09 2012
My vote goes to (a,b,c) and a b c. I never understood why some builtin storage class keywords have in front of them (e.g. property, safe, disable) and some don't (e.g. pure, nothrow). IMHO the cleanest design would be to have builtins as plain keywords (ie. no in front). And then xxx is reserved for UDA. I understand that this would be a breaking change and not likely to happen - just want to know the reasoning behind it. /Jonas
Nov 07 2012
On Wednesday, November 07, 2012 10:13:47 Jonas Drewsen wrote:My vote goes to (a,b,c) and a b c. I never understood why some builtin storage class keywords have in front of them (e.g. property, safe, disable) and some don't (e.g. pure, nothrow). IMHO the cleanest design would be to have builtins as plain keywords (ie. no in front). And then xxx is reserved for UDA. I understand that this would be a breaking change and not likely to happen - just want to know the reasoning behind it.It mainly came down to not wanting to add new keywords. By using safe instead of safe, safe could still be used as a variable or function or whatnot. There was some discussion of which should have on them on which not (e.g. nothrow vs nothrow was debated), but the decision was fairly arbitrary. If anything though, had we not cared about breaking code or whether D looked similar to other languages, we probably would have made _all_ attributes start with (including stuff like public). It would have been wonderfully consistent that way, but it wasn't ultimately deemed a good idea. So, basically, was introduced to avoid adding more keywords. It certainly makes sense to extend it for using with user defined attributes, but that wasn't really the original intention. - Jonathan M Davis
Nov 07 2012
On 2012-11-07 10:22, Jonathan M Davis wrote:It mainly came down to not wanting to add new keywords. By using safe instead of safe, safe could still be used as a variable or function or whatnot. There was some discussion of which should have on them on which not (e.g. nothrow vs nothrow was debated), but the decision was fairly arbitrary. If anything though, had we not cared about breaking code or whether D looked similar to other languages, we probably would have made _all_ attributes start with (including stuff like public). It would have been wonderfully consistent that way, but it wasn't ultimately deemed a good idea.And then we would suddenly have Objective-C :( -- /Jacob Carlborg
Nov 07 2012
On Wednesday, 7 November 2012 at 09:23:44 UTC, Jonathan M Davis wrote:On Wednesday, November 07, 2012 10:13:47 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() { } /JonasMy vote goes to (a,b,c) and a b c. I never understood why some builtin storage class keywords have in front of them (e.g. property, safe, disable) and some don't (e.g. pure, nothrow). IMHO the cleanest design would be to have builtins as plain keywords (ie. no in front). And then xxx is reserved for UDA. I understand that this would be a breaking change and not likely to happen - just want to know the reasoning behind it.It mainly came down to not wanting to add new keywords. By using safe instead of safe, safe could still be used as a variable or function or whatnot. There was some discussion of which should have on them on which not (e.g. nothrow vs nothrow was debated), but the decision was fairly arbitrary. If anything though, had we not cared about breaking code or whether D looked similar to other languages, we probably would have made _all_ attributes start with (including stuff like public). It would have been wonderfully consistent that way, but it wasn't ultimately deemed a good idea. So, basically, was introduced to avoid adding more keywords. It certainly makes sense to extend it for using with user defined attributes, but that wasn't really the original intention. - Jonathan M Davis
Nov 07 2012
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.
Nov 07 2012
Le 07/11/2012 21:24, Walter Bright a écrit :On 11/7/2012 11:40 AM, Jonas Drewsen wrote: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.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.
Nov 07 2012
On 11/7/12 10:24 PM, Walter Bright wrote:On 11/7/2012 11:40 AM, Jonas Drewsen wrote:I think it's solvable. The basic approach would be to plop types "safe", "nothrow" etc. in object.di and then let them just behave like all other arguments. AndreiI 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.
Nov 07 2012
On Thursday, 8 November 2012 at 00:03:34 UTC, Andrei Alexandrescu wrote:I think it's solvable. The basic approach would be to plop types "safe", "nothrow" etc. in object.di and then let them just behave like all other arguments."nothrow" isn't actually an attribute. So much for the value of consistency… :o) David
Nov 07 2012
On 11/8/12, David Nadlinger <see klickverbot.at> wrote:On Thursday, 8 November 2012 at 00:03:34 UTC, Andrei Alexandrescu wrote: "nothrow" isn't actually an attribute. So much for the value of consistency=85 :o)Another classic inconsistency: disable and deprecated Not only that but I keep writing the former as disabled and get CT errors.
Nov 07 2012
Le 08/11/2012 01:14, Andrej Mitrovic a écrit :On 11/8/12, David Nadlinger<see klickverbot.at> wrote:Good new for you, with the given proposal, you'll be able to do alias deprecate deprecated;On Thursday, 8 November 2012 at 00:03:34 UTC, Andrei Alexandrescu wrote: "nothrow" isn't actually an attribute. So much for the value of consistency… :o)Another classic inconsistency: disable and deprecated Not only that but I keep writing the former as disabled and get CT errors.
Nov 09 2012
On 2012-11-09, 15:26, deadalnix wrote:Le 08/11/2012 01:14, Andrej Mitrovic a =C3=A9crit :On 11/8/12, David Nadlinger<see klickverbot.at> wrote:On Thursday, 8 November 2012 at 00:03:34 UTC, Andrei Alexandrescu wrote: "nothrow" isn't actually an attribute. So much for the value of consistency=E2=80=A6 :o)Another classic inconsistency: disable and deprecated Not only that but I keep writing the former as disabled and get CT =Or even: alias deprecated =3D deprecate; -- = Simenerrors.Good new for you, with the given proposal, you'll be able to do alias deprecate deprecated;
Nov 09 2012
On 11/7/2012 4:03 PM, Andrei Alexandrescu wrote:On 11/7/12 10:24 PM, Walter Bright wrote:Consider that if we do that, then someone will need to disambiguate with: object.safe which is ambiguous: a.b .c x = 3; or is it: a .b.c x = 3; ? Another problem is it pushes off recognition of safe from the parser to the semantic analyzer. This has unknown forward reference complications.On 11/7/2012 11:40 AM, Jonas Drewsen wrote:I think it's solvable. The basic approach would be to plop types "safe", "nothrow" etc. in object.di and then let them just behave like all other arguments.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.
Nov 07 2012
Am 08.11.2012 02:48, schrieb Walter Bright:On 11/7/2012 4:03 PM, Andrei Alexandrescu wrote:In that case $(object.safe) would be required - the shortcut then only works for simple identifiers and would error out going with the second option ("object is not an attribute" or something). Templates basically have the same ambiguity: A!x.y.zOn 11/7/12 10:24 PM, Walter Bright wrote:Consider that if we do that, then someone will need to disambiguate with: object.safe which is ambiguous: a.b .c x = 3; or is it: a .b.c x = 3; ? Another problem is it pushes off recognition of safe from the parser to the semantic analyzer. This has unknown forward reference complications.On 11/7/2012 11:40 AM, Jonas Drewsen wrote:I think it's solvable. The basic approach would be to plop types "safe", "nothrow" etc. in object.di and then let them just behave like all other arguments.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.
Nov 08 2012
On 2012-11-08 02:48, Walter Bright wrote:Consider that if we do that, then someone will need to disambiguate with: object.safe which is ambiguous: a.b .c x = 3; or is it: a .b.c x = 3; ?I would say: a.b .c x = 3; I mean, we read left to right, at least with source code. But as Sönke said, that could require parentheses: (a.b) .c x = 3;Another problem is it pushes off recognition of safe from the parser to the semantic analyzer. This has unknown forward reference complications.Just make it a keyword? The current attributes are already keywords from a user/developer point of view. -- /Jacob Carlborg
Nov 08 2012
Le 08/11/2012 02:48, Walter Bright a écrit :On 11/7/2012 4:03 PM, Andrei Alexandrescu wrote:How didn't see that coming. I never was a big fan of .identifier syntax for module level stuff. However, you example isn't quite correct. Attributes are for symbols, and your example don't create any new symbol. Let's consider a.b .c d = 3; Now, we have several option to disambiguate that. The first, obvious one is to use () : (a.b) .c d = 3; . When not using (), the compiler understand this as (a.b.c) d = 3; which is an error. Another option is to use auto : a.b auto d = .c(3); Anyway, I don't expect this to break too much code, if any.On 11/7/12 10:24 PM, Walter Bright wrote:Consider that if we do that, then someone will need to disambiguate with: object.safe which is ambiguous: a.b .c x = 3; or is it: a .b.c x = 3; ? Another problem is it pushes off recognition of safe from the parser to the semantic analyzer. This has unknown forward reference complications.On 11/7/2012 11:40 AM, Jonas Drewsen wrote:I think it's solvable. The basic approach would be to plop types "safe", "nothrow" etc. in object.di and then let them just behave like all other arguments.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.
Nov 09 2012
On Thursday, 8 November 2012 at 00:03:34 UTC, Andrei Alexandrescu wrote:On 11/7/12 10:24 PM, Walter Bright wrote:The original argument that the in front of safe is a way to prevent introducing new keywords is all gone then since "safe" becomes a normal symbol which is reserved in the library and in the compiler to let it do its magic. Then safe could just as well be a normal builtin storage class called "safe". * Plopping types "safe","nothrow" etc. into object.di would be a breaking change. * Making safe, nothrow into keywords called "safe", "nothrow" would be breaking change. The latter would be the cleanest cut and not have the semantic/parse stage problems that Walter mentioned. Another option would to enforce parenthesis (safe) for UDA which would make it less nice for the eyes to look at. /JonasOn 11/7/2012 11:40 AM, Jonas Drewsen wrote:I think it's solvable. The basic approach would be to plop types "safe", "nothrow" etc. in object.di and then let them just behave like all other arguments.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.
Nov 08 2012
On Thursday, 8 November 2012 at 11:01:13 UTC, Jonas Drewsen wrote:On Thursday, 8 November 2012 at 00:03:34 UTC, Andrei Alexandrescu wrote:Not safe but safe should become a keyword.On 11/7/12 10:24 PM, Walter Bright wrote:The original argument that the in front of safe is a way to prevent introducing new keywords is all gone then since "safe" becomes a normal symbol which is reserved in the library and in the compiler to let it do its magic. Then safe could just as well be a normal builtin storage class called "safe". * Plopping types "safe","nothrow" etc. into object.di would be a breaking change. * Making safe, nothrow into keywords called "safe", "nothrow" would be breaking change. The latter would be the cleanest cut and not have the semantic/parse stage problems that Walter mentioned. Another option would to enforce parenthesis (safe) for UDA which would make it less nice for the eyes to look at. /JonasOn 11/7/2012 11:40 AM, Jonas Drewsen wrote:I think it's solvable. The basic approach would be to plop types "safe", "nothrow" etc. in object.di and then let them just behave like all other arguments.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.
Nov 08 2012
Le 08/11/2012 12:01, Jonas Drewsen a écrit :On Thursday, 8 November 2012 at 00:03:34 UTC, Andrei Alexandrescu wrote:nothrow is already a keyword (which is really inconsistent). I'm not sure what it does buy us, and both safe and nothrow are good candidates for lib implementation rather than compiler support.On 11/7/12 10:24 PM, Walter Bright wrote:The original argument that the in front of safe is a way to prevent introducing new keywords is all gone then since "safe" becomes a normal symbol which is reserved in the library and in the compiler to let it do its magic. Then safe could just as well be a normal builtin storage class called "safe". * Plopping types "safe","nothrow" etc. into object.di would be a breaking change. * Making safe, nothrow into keywords called "safe", "nothrow" would be breaking change. The latter would be the cleanest cut and not have the semantic/parse stage problems that Walter mentioned. Another option would to enforce parenthesis (safe) for UDA which would make it less nice for the eyes to look at. /JonasOn 11/7/2012 11:40 AM, Jonas Drewsen wrote:I think it's solvable. The basic approach would be to plop types "safe", "nothrow" etc. in object.di and then let them just behave like all other arguments.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.
Nov 09 2012
Am Fri, 09 Nov 2012 15:28:40 +0100 schrieb deadalnix <deadalnix gmail.com>:nothrow is already a keyword (which is really inconsistent). I'm not sure what it does buy us, and both safe and nothrow are good candidates for lib implementation rather than compiler support.That requires that the compiler exposes all sorts of statistical data for every statement. E.g. to check if nothrow is violated you have to find statements that throw something and then check if there is a catch block around that, that catches it. If a statement is a function call, you would ask the compiler if that function throws. (In particular if it is a templated function with deduced 'nothrow' and ' safe'). And there you are at the point that you just duplicated the compiler code in the library. -- Marco
Nov 10 2012
Am 10.11.2012 11:21, schrieb Marco Leise:Am Fri, 09 Nov 2012 15:28:40 +0100 schrieb deadalnix <deadalnix gmail.com>:Not duplicated, but moved - which results in a simpler compiler implementation, definitely a good thing. Of course those AST analytics/maccro functionality has to be added in return, but since this has a much broader scope and would make other features (string mixins) obsolete, even that is not quite clear in terms of weight as a counter argument. Anyway, I surely wouldn't expect this to happen anytime soon, but keeping this path open seems like a wise decision - it's a great opportunity to remove/not add features from/to the language without trading functinality or even syntax.nothrow is already a keyword (which is really inconsistent). I'm not sure what it does buy us, and both safe and nothrow are good candidates for lib implementation rather than compiler support.That requires that the compiler exposes all sorts of statistical data for every statement. E.g. to check if nothrow is violated you have to find statements that throw something and then check if there is a catch block around that, that catches it. If a statement is a function call, you would ask the compiler if that function throws. (In particular if it is a templated function with deduced 'nothrow' and ' safe'). And there you are at the point that you just duplicated the compiler code in the library.
Nov 10 2012
On 2012-11-07 20:40, 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() { }The current attributes are keywords from a user/developer point view. -- /Jacob Carlborg
Nov 08 2012
On Tuesday, 6 November 2012 at 19:18:39 UTC, Walter Bright wrote:For User Defined Attributes. In the north corner we have the current champeeeeon: ------- [ ArgumentList ] Pros: looks nice Cons: not so greppable parsing ambiguity with [array literal].func(); ------ In the south corner, there's the chaaaaallenger: ( ArgumentList ) Pros: looks like existing attribute syntax no parsing problems Cons: not as nice looking ------ No hitting below the belt! Let the games begin!I prefer the (list) syntax because we already have attributes and that is what we are all familiar with. Regards
Nov 07 2012
On 11/06/2012 08:18 PM, Walter Bright wrote:( ArgumentList ) ...I do not like that one as I already use the syntax.
Nov 07 2012
On 11/7/2012 9:00 AM, Timon Gehr wrote:On 11/06/2012 08:18 PM, Walter Bright wrote:That currently isn't accepted by the D compiler - what are you already using it for?( ArgumentList ) ...I do not like that one as I already use the syntax.
Nov 07 2012
On 11/07/2012 09:20 PM, Walter Bright wrote:On 11/7/2012 9:00 AM, 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); }));On 11/06/2012 08:18 PM, Walter Bright wrote:That currently isn't accepted by the D compiler - what are you already using it for?( ArgumentList ) ...I do not like that one as I already use the syntax.
Nov 07 2012
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?
Nov 07 2012
On 11/07/2012 11:42 PM, Walter Bright wrote:On 11/7/2012 1:16 PM, Timon Gehr wrote: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]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?
Nov 07 2012
Le 07/11/2012 22:16, Timon Gehr a écrit :On 11/07/2012 09:20 PM, Walter Bright wrote: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 ?On 11/7/2012 9:00 AM, 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); }));On 11/06/2012 08:18 PM, Walter Bright wrote:That currently isn't accepted by the D compiler - what are you already using it for?( ArgumentList ) ...I do not like that one as I already use the syntax.
Nov 07 2012
On 2012-11-07 22:16, 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); }));This is what we need AST macros for. -- /Jacob Carlborg
Nov 08 2012
Am 06.11.2012 20:18, schrieb Walter Bright:For User Defined Attributes. In the north corner we have the current champeeeeon: ------- [ ArgumentList ] Pros: looks nice Cons: not so greppable parsing ambiguity with [array literal].func(); ------ In the south corner, there's the chaaaaallenger: ( ArgumentList ) Pros: looks like existing attribute syntax no parsing problems Cons: not as nice looking ------ No hitting below the belt! Let the games begin!Already too late to the party. I join my voice to the () group. -- Paulo
Nov 07 2012
(attribute) looks prettier to me, and with the other pros I syntax didn't make a lot of sense. I'm also for: attr1 attr2 int i; type syntax if that was being discussed previously (someone mentioned it). It would be very consistent with what's already there. Congrats on Attributes, BTW! Great news :)
Nov 07 2012
Le 06/11/2012 20:18, Walter Bright a écrit :For User Defined Attributes. In the north corner we have the current champeeeeon: ------- [ ArgumentList ] Pros: looks nice Cons: not so greppable parsing ambiguity with [array literal].func(); ------ In the south corner, there's the chaaaaallenger: ( ArgumentList ) Pros: looks like existing attribute syntax no parsing problems Cons: not as nice looking ------ No hitting below the belt! Let the games begin!About () vs [] the key point to me is that this is consistent with tuple syntax (which don't exists yet \o/). The important point to me is that a is allowed.
Nov 07 2012
On Tuesday, 6 November 2012 at 19:18:39 UTC, Walter Bright wrote:For User Defined Attributes. In the north corner we have the current champeeeeon: ------- [ ArgumentList ] Pros: looks nice Cons: not so greppable parsing ambiguity with [array literal].func(); ------ In the south corner, there's the chaaaaallenger: ( ArgumentList ) Pros: looks like existing attribute syntax no parsing problems Cons: not as nice looking ------ No hitting below the belt! Let the games begin!() with required (). So we will still have place for new language attributes like rox etc ;)
Nov 07 2012
Le 08/11/2012 00:14, nazriel a écrit :On Tuesday, 6 November 2012 at 19:18:39 UTC, Walter Bright wrote:Language attribute must die :DFor User Defined Attributes. In the north corner we have the current champeeeeon: ------- [ ArgumentList ] Pros: looks nice Cons: not so greppable parsing ambiguity with [array literal].func(); ------ In the south corner, there's the chaaaaallenger: ( ArgumentList ) Pros: looks like existing attribute syntax no parsing problems Cons: not as nice looking ------ No hitting below the belt! Let the games begin!() with required (). So we will still have place for new language attributes like rox etc ;)
Nov 07 2012