Re: [ceylon-users] Accessing function/method parameter via metamodel => index/name

25 views
Skip to first unread message
Message has been deleted

Gavin King

unread,
Sep 25, 2016, 11:09:58 AM9/25/16
to ceylon...@googlegroups.com
Hi, no, this is not currently possible. The rule is that you're only
allowed to reference things that are in scope. 'someMethod()' is in
scope because it's shared. But 'one' is not.

I agree that this is a restriction we should probably relax. I'm not
sure if we already have an issue for that.

On Sun, Sep 25, 2016 at 4:59 PM, Wojciech Potiopa
<wojciech...@gmail.com> wrote:
>
>
> Hello, Let say we have interface declaration:
> shared interface SomeInterface{
>
> shared formal void someMethod(Integer one,String two);
>
> }
>
> We can access method metamodel like this:
> shared test void accessMethodMetamodel(){
> Method<SomeInterface,Anything,[Integer, String]> method =
> `SomeInterface.someMethod`;
>
> }
>
> Can we access each method parameter declaration/metamodel in some similar
> way ?
> //Not working
> shared test void accessMethodParameterByInstance(){
> `SomeInterface.someMethod.one`;
>
> }
>
>
> Thanks
> Wojciech
>
> --
> You received this message because you are subscribed to the Google Groups
> "ceylon-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ceylon-users...@googlegroups.com.
> To post to this group, send email to ceylon...@googlegroups.com.
> Visit this group at https://groups.google.com/group/ceylon-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ceylon-users/0b8dff99-d380-4634-82ee-fb2717ef394a%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



--
Gavin King
ga...@ceylon-lang.org
http://profiles.google.com/gavin.king
http://ceylon-lang.org
http://hibernate.org
http://seamframework.org
Message has been deleted

Gavin King

unread,
Sep 25, 2016, 11:31:20 AM9/25/16
to ceylon...@googlegroups.com
Yes, that's right.

On Sun, Sep 25, 2016 at 5:22 PM, Wojciech Potiopa
<wojciech...@gmail.com> wrote:
> Ok so the currently correct way is :
> shared test void accessMethodParameterByIndex(){
> FunctionOrValueDeclaration? functionOrValueDeclaration =
> `SomeInterface.someMethod`.declaration.parameterDeclarations[0];
> }
> ?
>
>
>
> On Sunday, 25 September 2016 16:59:54 UTC+2, Wojciech Potiopa wrote:
>>
>>
>>
>> Hello, Let say we have interface declaration:
>> shared interface SomeInterface{
>>
>> shared formal void someMethod(Integer one,String two);
>>
>> }
>>
>> We can access method metamodel like this:
>> shared test void accessMethodMetamodel(){
>> Method<SomeInterface,Anything,[Integer, String]> method =
>> `SomeInterface.someMethod`;
>>
>> }
>>
>> Can we access each method parameter declaration/metamodel in some similar
>> way ?
>> //Not working
>> shared test void accessMethodParameterByInstance(){
>> `SomeInterface.someMethod.one`;
>>
>> }
>>
>>
>> Thanks
>> Wojciech
>
> --
> You received this message because you are subscribed to the Google Groups
> "ceylon-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ceylon-users...@googlegroups.com.
> To post to this group, send email to ceylon...@googlegroups.com.
> Visit this group at https://groups.google.com/group/ceylon-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ceylon-users/7d84b5db-e7ec-46d9-8e38-7f5a4a79dab9%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages