<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
@font-face
        {font-family:"Lucida Sans Unicode";
        panose-1:2 11 6 2 3 5 4 2 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";
        color:#3333FF;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";
        color:#3333FF;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";
        color:#3333FF;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Consolas;
        color:#3333FF;}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";
        color:#3333FF;}
span.EmailStyle21
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.Section1
        {page:Section1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body bgcolor=white lang=EN-US link=blue vlink=purple><div class=Section1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Cool! Great repro. This issue is related to bug <a href="http://ironruby.codeplex.com/WorkItem/View.aspx?WorkItemId=1535">http://ironruby.codeplex.com/WorkItem/View.aspx?WorkItemId=1535</a> (Range is Enumerable and therefore implements Enumerable#to_a, which should be called by * operator). I’ve amended it and increased its priority to High.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>The workaround is to call to_ary/to_a explicitly:<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>&gt;&gt;&gt; r = 'a'..'d'<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>=&gt; &quot;a&quot;..&quot;d&quot;<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>&gt;&gt;&gt; [*(r.respond_to?(:to_ary) ? r.to_ary : r.to_a)].size<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>=&gt; 4<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Tomas<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext'>From:</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext'> ironruby-core-bounces@rubyforge.org [mailto:ironruby-core-bounces@rubyforge.org] <b>On Behalf Of </b>Philippe Monnet<br><b>Sent:</b> Monday, August 31, 2009 7:50 PM<br><b>To:</b> ironruby-core@rubyforge.org<br><b>Subject:</b> Re: [Ironruby-core] Trying to run _why's Camping framework on IronRack / IIS<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Lucida Sans Unicode","sans-serif"'>Now that I can run a minimalistic Camping app, I am moving on to get the Camping Blog app example to work.<br>As I am now testing additional features like Camping session and access to ActiveRecord on SQL Server, I am starting a list of issues I have encountered. These issues seem triggered by differences between the two Ruby implementations.<br>For example, the following code is used in the generation of a Camping session id:<br><br>&nbsp;&nbsp;&nbsp; - in MRI:<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; irb(main):001:0&gt; [*'a'..'d']<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; =&gt; [&quot;a&quot;, &quot;b&quot;, &quot;c&quot;, &quot;d&quot;]<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; irb(main):002:0&gt; [*'a'..'d'].size<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; =&gt; 4<br><br>&nbsp;&nbsp;&nbsp; - in IR:<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &gt;&gt;&gt; [*'a'..'d']<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =&gt; [&quot;a&quot;..&quot;d&quot;]<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &gt;&gt;&gt; [*'a'..'d'].size<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =&gt; 1<br><br>As of tonight I can now establish a session and get the cookies and session state to work right. But forms Once I am done, I will write-up the other findings and work-arounds.<br><br>Philippe<br></span><br>Jimmy Schementi wrote: <o:p></o:p></p><div><p class=MsoNormal>Ah, gotcha. Thanks for the explanation Tomas. I'll make that change.<br><br>~Jimmy <o:p></o:p></p><div><p class=MsoNormal>Sent from my phone<o:p></o:p></p></div></div><div><p class=MsoNormal style='margin-bottom:12.0pt'><br>On Aug 30, 2009, at 10:24 PM, &quot;Tomas Matousek&quot; &lt;<a href="mailto:Tomas.Matousek@microsoft.com">Tomas.Matousek@microsoft.com</a>&gt; wrote:<o:p></o:p></p></div><blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>The constant is not set when hosting IR and using Engine.Execute() or ScriptScope.Execute().</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>It is only set by ScriptSource.ExecuteProgram(). The reason is that each call to the former methods creates a new top-level binding and therefore we don’t know which one should be the one that is stored in TOPLEVEL_BINDING. The latter is meant to be used to execute the main top-level code (i.e. the “program”) and it sets the TOPLEVEL_BINDING up. It also handles SystemExit exception so that “exit” works according to Ruby’s semantics.</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>&nbsp;</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>IronRack should probably use ExecuteProgram to execute the main request processing script.</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>&nbsp;</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Tomas</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>&nbsp;</span><o:p></o:p></p><div><div style='border:none;border-top:solid windowtext 1.0pt;padding:3.0pt 0in 0in 0in;border-color:-moz-use-text-color -moz-use-text-color'><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext'>From:</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext'> <a href="mailto:ironruby-core-bounces@rubyforge.org">ironruby-core-bounces@rubyforge.org</a> [<a href="mailto:ironruby-core-bounces@rubyforge.org">mailto:ironruby-core-bounces@rubyforge.org</a>] <b>On Behalf Of </b>Philippe Monnet<br><b>Sent:</b> Sunday, August 30, 2009 1:05 PM<br><b>To:</b> <a href="mailto:ironruby-core@rubyforge.org">ironruby-core@rubyforge.org</a><br><b>Subject:</b> Re: [Ironruby-core] Trying to run _why's Camping framework on IronRack / IIS</span><o:p></o:p></p></div></div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>&nbsp;<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:10.0pt;font-family:"Lucida Sans Unicode","sans-serif"'>Today I dug deeper in the issue by breaking down the goes method of Camping in small chunks and evaluating them both in IR and MRI. I found that one thing expected by Camping was the global constant TOPLEVEL_BINDING.<br>Apparently the constant was not defined in IR. A Google search found it in:<br>&nbsp;&nbsp;&nbsp; ironruby/Merlin/Main/Languages/Ruby/Libs/hacks.rb<br>And when I explicitly required it, the constant appeared and Camping worked immediately on IronRack.<br>Could someone explain what the constant is for and why it is located in hacks.rb?<br>Is it ok to I be using hacks.rb?<br><br>Philippe<br><br>PS - I am pretty excited to run Camping now! I just had to make a couple changes on top of IronRack to make it work.<br></span><br>Philippe Monnet wrote: <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:10.0pt;font-family:"Lucida Sans Unicode","sans-serif"'>I have been leveraging IronRack to try to get a sample Camping application up and running.<br>I seem to be able to require the camping library fine but then as try to hit the famous &quot;Camping.goes :Demo&quot; line, IronRuby return an error stating that the constant #&lt;Class:Camping&gt; is not initialized.<br>So I tried to do the same test using the IR command line executable, but ran into the same issue (note that the same test works fine in IRB). What is strange is that the camping framework is loaded and if I query the constants in the Camping module I get back what I would expect. Is this a module loading issue? How can I troubleshoot this further?<br><br>Here is the IR's transcript:<br><br>&nbsp;&nbsp;&nbsp; ---------------<br>&nbsp;&nbsp;&nbsp; &gt;ir<br>&nbsp;&nbsp;&nbsp; IronRuby 0.9.0.0 on .NET 2.0.50727.3082<br>&nbsp;&nbsp;&nbsp; Copyright (c) Microsoft Corporation. All rights reserved.<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &gt;&gt;&gt; require 'rubygems'<br>&nbsp;&nbsp;&nbsp; =&gt; true<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &gt;&gt;&gt; gem 'rack'<br>&nbsp;&nbsp;&nbsp; =&gt; true<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &gt;&gt;&gt; require 'rack'<br>&nbsp;&nbsp;&nbsp; =&gt; true<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &gt;&gt;&gt; gem 'camping'<br>&nbsp;&nbsp;&nbsp; =&gt; true<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &gt;&gt;&gt; require 'camping'<br>&nbsp;&nbsp;&nbsp; =&gt; [&quot;Camping&quot;]<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &gt;&gt;&gt; require 'demo'<br>&nbsp;&nbsp;&nbsp; C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.3/lib/active_support/dependencies.rb:105:in `const_missing': uninitialized constant #&lt;Class:Camping&gt;::TOPLEVEL_BINDING (NameError)<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; from C:/Ruby/lib/ruby/gems/1.8/gems/camping-1.5.180/lib/camping.rb:39:in `goes'<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; from ./demo.rb:3<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; from :0<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; from :0:in `require'<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; from custom_require.rb:30:in `require'<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; from dependencies.rb:156:in `require'<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; from dependencies.rb:490:in `new_constants_in'<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; from dependencies.rb:154:in `require'<br><br>&nbsp;&nbsp;&nbsp; ---------------<br>And the basic 'demo.rb' looks like the following:<br><br>require 'camping'<br><br>Camping.goes :Demo<br><br>module Demo<br>&nbsp; def Demo.create<br>&nbsp; end<br>end<br><br>module Demo::Models<br>end<br><br>module Demo::Controllers<br>&nbsp; class Index &lt; R '/'<br>&nbsp;&nbsp;&nbsp; def get<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; render :index<br>&nbsp;&nbsp;&nbsp; end<br>&nbsp; end<br>end<br><br>module Demo::Views<br>&nbsp; def layout<br>&nbsp;&nbsp;&nbsp; html do<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; body do<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self &lt;&lt; yield<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end<br>&nbsp;&nbsp;&nbsp; end<br>&nbsp; end<br>&nbsp; <br>&nbsp; def index<br>&nbsp;&nbsp;&nbsp; h1 <a href="mailto:#%7B@input.name%7D,WelcometomyIronCampingdemo%21">&quot;#{@input.name}, Welcome to my IronCamping demo!&quot;</a><br>&nbsp; end<br>end<br><br><br>&nbsp;<br><br><br><br><br><br></span><o:p></o:p></p><pre>&nbsp;<o:p></o:p></pre><pre style='text-align:center'><hr size=4 width="90%" align=center></pre><pre>&nbsp;<o:p></o:p></pre><pre>_______________________________________________<o:p></o:p></pre><pre>Ironruby-core mailing list<o:p></o:p></pre><pre><a href="mailto:Ironruby-core@rubyforge.org">Ironruby-core@rubyforge.org</a><o:p></o:p></pre><pre><a href="http://rubyforge.org/mailman/listinfo/ironruby-core">http://rubyforge.org/mailman/listinfo/ironruby-core</a><o:p></o:p></pre><pre>&nbsp; <o:p></o:p></pre><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>&nbsp;<o:p></o:p></p></div></div></blockquote><blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><div><p class=MsoNormal>_______________________________________________<br>Ironruby-core mailing list<br><a href="mailto:Ironruby-core@rubyforge.org">Ironruby-core@rubyforge.org</a><br><a href="http://rubyforge.org/mailman/listinfo/ironruby-core">http://rubyforge.org/mailman/listinfo/ironruby-core</a><o:p></o:p></p></div></blockquote><pre><o:p>&nbsp;</o:p></pre><pre style='text-align:center'><hr size=4 width="90%" align=center></pre><pre><o:p>&nbsp;</o:p></pre><pre>_______________________________________________<o:p></o:p></pre><pre>Ironruby-core mailing list<o:p></o:p></pre><pre><a href="mailto:Ironruby-core@rubyforge.org">Ironruby-core@rubyforge.org</a><o:p></o:p></pre><pre><a href="http://rubyforge.org/mailman/listinfo/ironruby-core">http://rubyforge.org/mailman/listinfo/ironruby-core</a><o:p></o:p></pre><pre>  <o:p></o:p></pre><p class=MsoNormal><o:p>&nbsp;</o:p></p></div></body></html>