Simon Hausmann <simon.hausm...@qt.io> wrote: > > bar shall be a global variable that is callable (i.e. somebody > initialized it with a function closure). When invoked it shall return > either a primitive value or a JavaScript object and takes one arbitrary > parameter. > > > It is an implementation detail whether it returns the parameter provided, > or "42" (either as string or number :) and the behavior may change at > run-time. > > > So at the compilation time of this snippet, all we basically know is > > > var bar; > > > It could be that bar was initialized to "100", in which case I think an > exception would be thrown at the attempt of calling it. > > > Simon > > ________________________________ > From: Development > <development-bounces+simon.hausmann=qt...@qt-project.org> on behalf of Phil > Bouchard > <philipp...@gmail.com> > Sent: Tuesday, July 11, 2017 1:49:05 PM > To: development@qt-project.org > Subject: Re: [Development] Qt 5.9's new garbage collector documentation? + > root_ptr > > On 07/11/2017 04:02 AM, Tim Blechmann wrote: >>> On the other hand, I have good news as I think I have found a way to >>> simulate functions that return a function. >> >> how to you cope with structures like: >> >> function foo( outObject ) >> { >> var object = {} >> outObject.object = object >> outObject.result = function() { return object } >> return function() { return bar( object ) } >> } > > I'm looking into stuff like that so I am mimicking a run-time stack in > my example: > https://github.com/philippeb8/root_ptr/blob/qt/example/javascript_example1.cpp > > Meanwhile please define bar(); > > > Thanks, > -Phil > > _______________________________________________ > Development mailing list > Development@qt-project.org > http://lists.qt-project.org/mailman/listinfo/development > > --_000_VI1PR02MB10065F354A27556625565A498CAE0VI1PR02MB1006eurp_ > Content-Type: text/html; charset="us-ascii" > Content-Transfer-Encoding: quoted-printable > > <html> > <head> > <meta http-equiv="Content-Type" content="text/html; charset=us-ascii"> > <meta name="Generator" content="Microsoft Exchange Server"> > <!-- converted from text --><style><!-- .EmailQuote { margin-left: 1pt; > padding-left: 4pt; border-left: #800000 2px solid; } --></style> > </head> > <body> > <meta content="text/html; charset=UTF-8"> > <style type="text/css" style=""> > <!-- > p > {margin-top:0; > margin-bottom:0} > --> > </style> > <div dir="ltr"> > <div id="x_divtagdefaultwrapper" dir="ltr" style="font-size:12pt; > color:#000000; font-family:Calibri,Helvetica,sans-serif"> > <p><br> > </p> > <p>bar shall be a global variable that is callable (i.e. somebody > initialized it with a function closure). When invoked it shall > return <span style="font-size:12pt">either a > </span><span style="font-size:12pt">primitive value or a JavaScript > object and takes one arbitrary > </span><span style="font-size:12pt">parameter.</span></p> > <p><br> > </p> > <p>It is an implementation detail whether it returns the parameter > provided, or "42" (either as string or number :) and the > behavior may change at run-time.</p> > <p><br> > </p> > <p>So at the compilation time of this snippet, all we basically know is</p> > <p><br> > </p> > <p> var bar;</p> > <p><br> > </p> > <p>It could be that bar was initialized to "100", in which case > I think an exception would be thrown at the attempt of calling it.</p> > <p><br> > </p> > <p>Simon</p> > </div> > <hr tabindex="-1" style="display:inline-block; width:98%"> > <div id="x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" > color="#000000" style="font-size:11pt"><b>From:</b> Development > <development-bounces+simon.hausmann=qt...@qt-project.org> on > behalf of Phil Bouchard <philipp...@gmail.com><br> > <b>Sent:</b> Tuesday, July 11, 2017 1:49:05 PM<br> > <b>To:</b> development@qt-project.org<br> > <b>Subject:</b> Re: [Development] Qt 5.9's new garbage collector > documentation? + root_ptr</font> > <div> </div> > </div> > </div> > <font size="2"><span style="font-size:10pt;"> > <div class="PlainText">On 07/11/2017 04:02 AM, Tim Blechmann wrote:<br> > >> On the other hand, I have good news as I think I have found a way > to<br> > >> simulate functions that return a function.<br> > ><br> > > how to you cope with structures like:<br> > ><br> > > function foo( outObject )<br> > > {<br> > > var object = {}<br> > > outObject.object = object<br> > > outObject.result = function() { return object > }<br> > > return function() { return bar( object ) }<br> > > }<br> > <br> > I'm looking into stuff like that so I am mimicking a run-time stack in <br> > my example:<br> > <a > href="https://github.com/philippeb8/root_ptr/blob/qt/example/javascript_example1.cpp">https://github.com/philippeb8/root_ptr/blob/qt/example/javascript_example1.cpp</a><br> > <br> > Meanwhile please define bar();<br> > <br> > <br> > Thanks,<br> > -Phil<br> > <br> > _______________________________________________<br> > Development mailing list<br> > Development@qt-project.org<br> > <a > href="http://lists.qt-project.org/mailman/listinfo/development">http://lists.qt-project.org/mailman/listinfo/development</a><br> > </div> > </span></font> > </body> > </html> > > --_000_VI1PR02MB10065F354A27556625565A498CAE0VI1PR02MB1006eurp_--
Ok thanks. I'm confident it'll work. -Phil _______________________________________________ Development mailing list Development@qt-project.org http://lists.qt-project.org/mailman/listinfo/development