Page 1 of 1

Constants at Server vs. IDE

Posted: Tue Jul 26, 2011 3:25 am
by i2Internet
Why is it that at Server the following code:

Code: Select all

constant kTest="Constant TEST"
put kTest
... outputs:

kTest


... whereas at the LiveCode IDE the same code outputs what I'd expect:

Constant TEST


I'm manually porting over (re-creating) a framework I've developed in PHP to LiveCode (Server, and perhaps more) and having the ability to make use of constants will make all the difference (now having to rely on global variables, etc. instead).

Both tests are being done in LiveCode 4.6.3 at the IDE for Mac OS X (Lion) and on LiveCode 4.6.3 Server (at On-Rev and locally at the Mac).

Any assistance or further info will be greatly appreciated.

Thanks in advance,
- Kevin of Zaz Corp. USA

Re: Constants at Server vs. IDE

Posted: Tue Jul 26, 2011 3:00 pm
by BvG
Possibly constants are not supported on the server engine? Otherwise it'd look like a bug.

Re: Constants at Server vs. IDE

Posted: Tue Jul 26, 2011 4:42 pm
by jacque
Where in the script do you declare the constant?

Simple Script, and Live URL to Sample -shows put constant re

Posted: Tue Jul 26, 2011 11:30 pm
by i2Internet
Hi Jacque,

You asked:
jacque wrote:Where in the script do you declare the constant?
This is actually happening at a script where the only code that's there is as described:

Code: Select all

<?lc
	constant kTest="Constant TEST"
	put kTest
?>
See the code in action here using your web browser (remove space between the "." and "com"):
i.on-rev. com/test/constant.lc

Unless a fix is put in place at on-rev, I expect you'll see the folowing as described at top:

kTest


Thanks for the reply, Jacque - and thanks to BvG as well!

All the best,
- Kevin of Zaz Corp. USA

Re: Constants at Server vs. IDE

Posted: Wed Jul 27, 2011 2:16 am
by sturgis
Interestingly, if you do the following it sets the constant, but then its local to the handler not the script.

command checkConstant
constant ktest = "this is my constant"
put ktest
end checkConstant

checkConstant

Re: Constants at Server vs. IDE

Posted: Wed Jul 27, 2011 11:24 pm
by jacque
Interesting. I never tried using a constant in an irev script. They typically are placed outside of any handler, and it looks like if there is no declared handler then they don't work. I wonder if this is a bug or not. I can see it both ways.

Re: Constants at Server vs. IDE

Posted: Thu Aug 04, 2011 3:27 am
by i2Internet
Thank you for the followups sturgis and jacque.

I do see that the constant declaration does work within a handler, as sturgis has pointed out.

My primary interest is in having constants that can be declared at a preceding (include) script and then used throughout subsequent code. This capability is rather important and integral to various projects I have in the works.

I very much hope that on upcoming revision to LiveCode Server will support this. Thanks to the RunRev team in advance for anything that can be done to expedite things along these lines.

Regards,
- Kevin of Zaz Corp USA

Re: Constants at Server vs. IDE

Posted: Thu Aug 04, 2011 5:23 pm
by BvG
did you file it as a bug report? I'd like to vote on it, but can't find it.

Re: Constants at Server vs. IDE

Posted: Sat Aug 06, 2011 7:06 pm
by Martin Koob
I have a couple of bugs regarding Livecode Server and On-rev Editor that I would like to post but I am not sure what component to post them under. It seems there is not an existing one that matches. I posted a bug about about that for the QCC. THe bug number is 9653.
Regarding Livecode Server I asked:

I am not sure where to put bugs for Livecode Server. It would seem it
should be in

Engine > Build > Server

and/or

Engine > Platform > Mac OS X > Server
Engine > Platform > Windows > Server
Engine > Platform > Linux > Server

Does anyone have suggestions under which component to post livecode Server bugs?

Martin

Re: Constants at Server vs. IDE

Posted: Sat Aug 06, 2011 8:33 pm
by BvG
don't worry too much, if someone at RunRev decides that it's the wrong one, they'll change it for you. Any of those should be sufficient, but probably the OS-specific ones should be reserved for OS specific problems, no?