[Ironruby-core] IronRuby .Net 4 CTP and dynamic

Kevin Radcliffe kevin.radcliffe at gmail.com
Wed Mar 3 14:07:04 EST 2010


Patrick,
  Tomas made a fix for dynamic, and it is now included in the latest source
from git:
  http://github.com/ironruby/ironruby

  If you build the latest from source (make sure you build the "V4 Release"
(or V4 Debug) from ruby4.sln),
  your code (which deals with the ExpandoObject) should work as you expect.
  Thanks

Best Regards,
Kevin Radcliffe

On Fri, Nov 13, 2009 at 10:36 AM, Patrick Brown <patrickcbrown at gmail.com>wrote:

> Hi
>
>    Should I be able to call out to a C# method with this release that
> returns a dynamic and access it's return value?
>
> public class Modifier
> {
>  public dynamic Modify(IPropertyPolicyInfo info)
>  {
>   dynamic obj = new ExpandoObject();
>   obj.Name = info.AccountShortName;
>   obj.Address = new ExpandoObject();
>   obj.Address.LineOne = info.PolicyHQAddressLine1;
>   obj.Address.City = info.PolicyHQCityName;
>   return obj;
>  }
> }
>
> I get an exception saying "Unbound variable:value" when puts attempts to
> access t.Name.  I watch it in the debugger and can see that the dynamic
> object is fully populated prior to sending back to the script.
>
> policies.each { |info|
>     t =  modifier.Modify(info)
>     puts t.Name
> }
>
> Thanks,
> Patrick
>
> _______________________________________________
> Ironruby-core mailing list
> Ironruby-core at rubyforge.org
> http://rubyforge.org/mailman/listinfo/ironruby-core
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20100303/7040b59d/attachment-0001.html>


More information about the Ironruby-core mailing list