digitalmars.D.learn - parsing parameters
- Ellery Newcomer (4/4) Feb 22 2009 is there any reason to allow
- BCS (2/2) Feb 23 2009 I don't understand your question. Are you suggesting that something be a...
- Ellery Newcomer (4/8) Feb 23 2009 Why is it allowed?
- BCS (17/28) Feb 23 2009 Theory 1: it's a side effect of two features:
- Robert Fraser (5/45) Feb 23 2009 To elaborate, this would be useful for extern functions, i.e.
- BCS (3/35) Feb 23 2009 Ah, and yet another use. I think that is an even better theory than eith...
is there any reason to allow BasicType AnonymousDeclarator = AssignExpression as a parameter? As far as I know, it's gibberish (but, then, I don't know very far).
Feb 22 2009
I don't understand your question. Are you suggesting that something be added or asking why something is allowed?
Feb 23 2009
BCS wrote:I don't understand your question. Are you suggesting that something be added or asking why something is allowed?Why is it allowed? for example: int myfun(int=10);
Feb 23 2009
Reply to Ellery,BCS wrote:Theory 1: it's a side effect of two features: this is allowed int myFunc(int) // I never use the arg so why name it? { } and this is allowed int myFunc(int i = 5) // normal defaulting { } so to avoid corner cases they are allowed in combination theory 2: it gives a function (with an anon arg, see above) that can be called like this: myfun(5); and like this: myfun();I don't understand your question. Are you suggesting that something be added or asking why something is allowed?Why is it allowed? for example: int myfun(int=10);
Feb 23 2009
BCS wrote:Reply to Ellery,To elaborate, this would be useful for extern functions, i.e. extern(C) int myFunc(int = 5); myFunc(); // Calls myFunc(5); myFunc(6);BCS wrote:Theory 1: it's a side effect of two features: this is allowed int myFunc(int) // I never use the arg so why name it? { } and this is allowed int myFunc(int i = 5) // normal defaulting { } so to avoid corner cases they are allowed in combination theory 2: it gives a function (with an anon arg, see above) that can be called like this: myfun(5); and like this: myfun();I don't understand your question. Are you suggesting that something be added or asking why something is allowed?Why is it allowed? for example: int myfun(int=10);
Feb 23 2009
Hello Robert,BCS wrote:Ah, and yet another use. I think that is an even better theory than either of mine.Theory 1: it's a side effect of two features: this is allowed int myFunc(int) // I never use the arg so why name it? { } and this is allowed int myFunc(int i = 5) // normal defaulting { } so to avoid corner cases they are allowed in combination theory 2: it gives a function (with an anon arg, see above) that can be called like this: myfun(5); and like this: myfun();To elaborate, this would be useful for extern functions, i.e. extern(C) int myFunc(int = 5); myFunc(); // Calls myFunc(5); myFunc(6);
Feb 23 2009