Calling static functions

Oct 7, 2010 at 2:59 PM

In my language I want to be able to call static functions such as system.console.writeline()

I have managed to get this working just by using my language's FallbackInvokeMember function.

I took the Sympl version as a starting point and changed it as follows:

If the target is a TypeModel then I call GetMember on the the target's ReflType property

Otherwise I call GetMember on the target itself.

If the member found is a static method, I  construct an Expression.Call with a null instance parameter to call the static method.

Otherwise I construct an Expression.Call for a normal method call.

However, Sympl does not do this and I would like to know why, and if my method is valid.

 

 

 

Coordinator
Oct 7, 2010 at 5:47 PM

I can't recall now why I don't do this, but I may have said so in the doc or comments. I was going for really dumb quick resolution to illustrate more the end to end of binding. I also don't do other simple things like handle if the last arg is a params args for which my extra arguments could be passed into. Your tweak sounds fine to me, but Dino or Tomas who have coded up real .NET binding might be able to say if there's some edge case you should worry about.

cheers,

bill

From: atomicpigeon [mailto:notifications@codeplex.com]
Sent: Thursday, October 07, 2010 8:00 AM
To: Bill Chiles
Subject: Calling static functions [dlr:229996]

From: atomicpigeon

In my language I want to be able to call static functions such as system.console.writeline()

I have managed to get this working just by using my language's FallbackInvokeMember function.

I took the Sympl version as a starting point and changed it as follows:

If the target is a TypeModel then I call GetMember on the the target's ReflType property

Otherwise I call GetMember on the target itself.

If the member found is a static method, I construct an Expression.Call with a null instance parameter to call the static method.

Otherwise I construct an Expression.Call for a normal method call.

However, Sympl does not do this and I would like to know why, and if my method is valid.

Read the full discussion online.

To add a post to this discussion, reply to this email (dlr@discussions.codeplex.com)

To start a new discussion for this project, email dlr@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com

Coordinator
Oct 7, 2010 at 11:38 PM

This sounds perfectly fine – a possibly better solution would be to have the TypeModel implement IDMOP w/ a meta object which implements these semantics. Then these objects could be passed to other languages and still have the same semantics.

From: billchi [mailto:notifications@codeplex.com]
Sent: Thursday, October 07, 2010 10:48 AM
To: Dino Viehland
Subject: Re: Calling static functions [dlr:229996]

From: billchi

I can't recall now why I don't do this, but I may have said so in the doc or comments. I was going for really dumb quick resolution to illustrate more the end to end of binding. I also don't do other simple things like handle if the last arg is a params args for which my extra arguments could be passed into. Your tweak sounds fine to me, but Dino or Tomas who have coded up real .NET binding might be able to say if there's some edge case you should worry about.

cheers,

bill

From: atomicpigeon [mailto:notifications@codeplex.com]
Sent: Thursday, October 07, 2010 8:00 AM
To: Bill Chiles
Subject: Calling static functions [dlr:229996]

From: atomicpigeon

In my language I want to be able to call static functions such as system.console.writeline()

I have managed to get this working just by using my language's FallbackInvokeMember function.

I took the Sympl version as a starting point and changed it as follows:

If the target is a TypeModel then I call GetMember on the the target's ReflType property

Otherwise I call GetMember on the target itself.

If the member found is a static method, I construct an Expression.Call with a null instance parameter to call the static method.

Otherwise I construct an Expression.Call for a normal method call.

However, Sympl does not do this and I would like to know why, and if my method is valid.

Read the full discussion online.

To add a post to this discussion, reply to this email (dlr@discussions.codeplex.com)

To start a new discussion for this project, email dlr@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com

Read the full discussion online.

To add a post to this discussion, reply to this email (dlr@discussions.codeplex.com)

To start a new discussion for this project, email dlr@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com