You know, you're right. It does make sense in the other context. I guess it seems strange for the reason you state. I expect inline stuff to just work like php and when it doesn't I get hit with the flummox hammer.
On Fri, Feb 10, 2012 at 9:00 AM, Alex Tweedly <[email protected]> wrote: > Thanks Mike - that's basically it. > Though in fact, it's even stranger than you said. > > The dictionary says that if you set a constant in a script but outside any > handler, then it can be used in any handler within the script; and that's > exactly what it does do ... > > <?livecode >> constant K = "asdf" >> command doit >> constant K1 = "qwer" >> put "inside" && K && K1 & "<br>" >> end doit >> >> doit >> put "outside" && K && K1 & "<br>" >> >> ?> >> > produces > > inside asdf qwer > outside K K1 > > And that's pretty reasonable for a script in a stack (where you don't have > "executable" statements outside any handler), but very unhelpful for > revserver, where it is very common to have executable code "in-line" rather > than in side a handler. > > Oh well - I'll submit it as an enhancement request, and stop using > 'constant' for now. > > Thanks > -- Alex. > > On 10/02/2012 15:48, Mike Bonner wrote: > >> e I think there was a thread on this that I read before. >> >> If I recall correctly, setting a constant inside a handler works for THAT >> handler. So if you have. >> >> <?lc >> command tryConst >> constant k="inside handler" >> put k >> end tryConst >> >> tryconst >> >> "inside handler" will be displayed. But setting it outside of a handler >> doesn't work. >> >> If you have the following >> >> <?lc >> command showConst >> constant k="inside handler" >> put k >> end showConst >> constant k="OutsideHandler" >> put k >> showconst >> put k >> >> ?> >> >> You end up with kinsidehandlerk >> >> Keith, yeah revserver supports put. Anything that is "put" without a >> destination container ends up as part of the final page. >> >> On Fri, Feb 10, 2012 at 8:30 AM, Matthias Rebbe< >> matthias_livecode_150811@m-r-**d.de <[email protected]>> >> wrote: >> >> Hi Alex, >>> >>> Tried here with LiveCodeServer 5.0.2 and got the same result. :( >>> >>> Regards, >>> >>> Matthias >>> >>> Am 10.02.2012 um 16:01 schrieb Alex Tweedly: >>> >>> constant K = "asdf" >>>>> put K >>>>> >>>> If I put the above 2 lines in a script in a stack or in the IDE/msgbox, >>>> >>> I get (as expected) "asdf" output. >>> >>>> But if do the same thing in a revserver script (in my case, on-rev), I >>>> >>> get "K". >>> >>>> That seems wrong to me, and the dictionary for constant includes server >>>> >>> in its platform list. >>> >>>> Am I missing something ? Can someone else try it and see if I'm doing >>>> >>> something odd. >>> >>>> Thanks >>>> -- Alex. >>>> >>>> ______________________________**_________________ >>>> use-livecode mailing list >>>> [email protected] >>>> Please visit this url to subscribe, unsubscribe and manage your >>>> >>> subscription preferences: >>> >>>> http://lists.runrev.com/**mailman/listinfo/use-livecode<http://lists.runrev.com/mailman/listinfo/use-livecode> >>>> >>> >>> ______________________________**_________________ >>> use-livecode mailing list >>> [email protected] >>> Please visit this url to subscribe, unsubscribe and manage your >>> subscription preferences: >>> http://lists.runrev.com/**mailman/listinfo/use-livecode<http://lists.runrev.com/mailman/listinfo/use-livecode> >>> >>> ______________________________**_________________ >> use-livecode mailing list >> [email protected] >> Please visit this url to subscribe, unsubscribe and manage your >> subscription preferences: >> http://lists.runrev.com/**mailman/listinfo/use-livecode<http://lists.runrev.com/mailman/listinfo/use-livecode> >> >> > > ______________________________**_________________ > use-livecode mailing list > [email protected] > Please visit this url to subscribe, unsubscribe and manage your > subscription preferences: > http://lists.runrev.com/**mailman/listinfo/use-livecode<http://lists.runrev.com/mailman/listinfo/use-livecode> > _______________________________________________ use-livecode mailing list [email protected] Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
