- Code: Select all
[return:AttributeName]
public object MethodName(){
return null;
}
Forums
[return:AttributeName]
11 posts
• Page 1 of 2 • 1, 2
[return:AttributeName]
Is there a way to do like c#:
- gauthier
- Posts: 116
Re: [return:AttributeName]
No, I guess there isn't. What do you think the syntax should be? Here are the current test cases:
<workspace>/Tests/320-misc-two/800-attributes
Although the source will look better in your local editor with syntax highlighting.
<workspace>/Tests/320-misc-two/800-attributes
Although the source will look better in your local editor with syntax highlighting.
- Charles
- Posts: 2515
- Location: Los Angeles, CA
Re: [return:AttributeName]
it could be
or anyother idea that looks better?
also, I'm in need for attribute on method parameters:
could be
def methodName as dynamic
has return(AttributeName(someValue="value")), Another(withAnotherValue="another one")
return 1
or anyother idea that looks better?
also, I'm in need for attribute on method parameters:
- Code: Select all
void MethodName([AttributeName]object argument){}
could be
def methodName(argument has AttributeName as Object)
pass
- gauthier
- Posts: 116
Re: [return:AttributeName]
Can you provide some actual attribute names you will be using for return and parameter attributes? I just want to see some concrete examples from your own use.
- Charles
- Posts: 2515
- Location: Los Angeles, CA
Re: [return:AttributeName]
JSONReturnBinder :
http://hammett.castleproject.org/?p=247
and DataBind :
http://www.castleproject.org/monorail/d ... l#databind
both from MonoRail MVC framework
http://hammett.castleproject.org/?p=247
and DataBind :
http://www.castleproject.org/monorail/d ... l#databind
both from MonoRail MVC framework
- gauthier
- Posts: 116
Re: [return:AttributeName]
Thanks. For parameters, I'm thinking: which follows the same format as methods where "has Attribute" follows "as Type".
For return attributes I was thinking of just using the "return" keyword as a prefix:
Thoughts? Feelings?
use Castle.MonoRail.Framework
class ProductController inherits SmartDispatcherController
def create(prod as Product has DataBind('product'))
pass
For return attributes I was thinking of just using the "return" keyword as a prefix:
class Foo
def getStates(countryCode as String) as State[]
has return JSONReturnBinder
return stateRepository.fetchAllByCountry(Country(countryCode))
Thoughts? Feelings?
- Charles
- Posts: 2515
- Location: Los Angeles, CA
Re: [return:AttributeName]
Chuck,
the only inconsistence with the parameter attribute is that the "has AttributeName" occurs somewhat after the parameter name to which it is attached,
but you are right that this is consistent with class and method declarations (however mostly occuring on another line) so it may be the right solution.
as for the second sample, that feel quite good to me
what others think about that?
the only inconsistence with the parameter attribute is that the "has AttributeName" occurs somewhat after the parameter name to which it is attached,
but you are right that this is consistent with class and method declarations (however mostly occuring on another line) so it may be the right solution.
as for the second sample, that feel quite good to me
what others think about that?
- gauthier
- Posts: 116
Re: [return:AttributeName]
I have added the attributes for parameters in the Cobra repository. changeset:2102
Try it out and let me know if you have any problems.
I'll try to do the "return" attribute soon.
Try it out and let me know if you have any problems.
I'll try to do the "return" attribute soon.
- Charles
- Posts: 2515
- Location: Los Angeles, CA
Re: [return:AttributeName]
Chuck, that's working all along for my purpose, thank you!
- gauthier
- Posts: 116
Re: [return:AttributeName]
No problem. Now I've added support for the "return" target in changeset:2103. Try it out and let me know how it goes.
- Charles
- Posts: 2515
- Location: Los Angeles, CA
11 posts
• Page 1 of 2 • 1, 2
Who is online
Users browsing this forum: No registered users and 40 guests