Re: Passing parameters by reference

2012-03-13 Thread Dar Scott
Hi, Bob! On Mar 13, 2012, at 9:37 AM, Bob Sneidar wrote: > That is what passing an element to an array amounts to was my point. I think > what you are calling a statement many will call an expression. This concern is understandable. However, I think we can distinguish between an expression t

Re: Passing parameters by reference

2012-03-13 Thread Bob Sneidar
That is what passing an element to an array amounts to was my point. Bob On Mar 12, 2012, at 5:39 PM, Pete wrote: > I'm not sure whose post you're responding to Bob. Where do you see > something that amounts to a statement being passed as a referenced > parameter? > Pete > > On Mon, Mar 12,

Re: Passing parameters by reference

2012-03-12 Thread Dar Scott
On Mar 12, 2012, at 11:18 PM, Mark Wieder wrote: > You'd have to somehow prevent the dereferencing of myArray[myKey] in > order to pass it by reference. Just as the dereferencing of x would have be be prevented to pass it as reference. Perhaps any mutable place is the same. Dar _

Re: Passing parameters by reference

2012-03-12 Thread Mark Wieder
Pete- Monday, March 12, 2012, 5:39:16 PM, you wrote: > I'm not sure whose post you're responding to Bob. Where do you see > something that amounts to a statement being passed as a referenced > parameter? Here's the problem: a parameter of the form array["key"] is not a pointer to the "key" elem

Re: Passing parameters by reference

2012-03-12 Thread Pete
I'm not sure whose post you're responding to Bob. Where do you see something that amounts to a statement being passed as a referenced parameter? Pete On Mon, Mar 12, 2012 at 3:04 PM, Bob Sneidar wrote: > Just weighing in here, that would be a bit confusing. Passing by reference > means that the

Re: Passing parameters by reference

2012-03-12 Thread Bob Sneidar
Just weighing in here, that would be a bit confusing. Passing by reference means that the command or function has access to the variable passed to it. By passing what amounts to a statement, there is nothing for LC to manipulate on the other end. Statements have to have some place to put the res

Re: Passing parameters by reference

2012-03-12 Thread Dick Kriesel
On Mar 12, 2012, at 11:41 AM, Pete wrote: > I guess you might say Dick is array of sunshine in this dark world of LC we > live in? Oh, for Pete's sake! ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsu

Re: Passing parameters by reference

2012-03-12 Thread Dick Kriesel
On Mar 12, 2012, at 11:12 AM, Mark Wieder wrote: > Dick is well known as the master of arrays. I've learned to just > accept his advice without questioning. I didn't know that! But, I make so many misteaks that I have to recomend that you resume questoining. -- Dick ___

Re: Passing parameters by reference

2012-03-12 Thread Dick Kriesel
On Mar 12, 2012, at 10:19 AM, Pete wrote: > I'm wondering how you found about about this key values array feature? I > can't find any mention of it in the dictionary or the reference manual and > it sure seems like something that should be known! I found it while looking through bug reports for

Re: Passing parameters by reference

2012-03-12 Thread Pete
I guess you might say Dick is array of sunshine in this dark world of LC we live in? Pete On Mon, Mar 12, 2012 at 11:12 AM, Mark Wieder wrote: > Pete- > > Monday, March 12, 2012, 10:19:14 AM, you wrote: > > > I'm wondering how you found about about this key values array feature? I > > can't find

Re: Passing parameters by reference

2012-03-12 Thread Mark Wieder
Pete- Monday, March 12, 2012, 10:19:14 AM, you wrote: > I'm wondering how you found about about this key values array feature? I > can't find any mention of it in the dictionary or the reference manual and > it sure seems like something that should be known! Dick is well known as the master of

Re: Passing parameters by reference

2012-03-12 Thread Pete
Hi Dick, Thanks again for this tip. I ended up using it to solve my problem by passing the whole array variable along with an optional second parameter which is a list of comma-separated key values. The function turns the key values list into an array then uses it to access the data array. If th

Re: Passing parameters by reference

2012-03-10 Thread Pete
That would work but the complication is that the function is already returning true or false to indicate whether it changed the input or not so I can do something like: if modified(tvar) then --do something else --do something else end if If I change it to return the result of it's operation

Re: Passing parameters by reference

2012-03-10 Thread Dar Scott
Thanks for the tip, Dick, on using the list of keys. One can think of arrays as nested or multidimensional. On Mar 10, 2012, at 1:06 AM, Dick Kriesel wrote: > I agree it'd be good if LC could accept any array reference for invoking a > handler that specifies pass-by-reference. Though is is pro

Re: Passing parameters by reference

2012-03-10 Thread Dar Scott
On Mar 10, 2012, at 11:21 AM, Pete wrote: > I may as well just change the function to return the > result of its code and pass the parameter by value instead of reference. Hmm. Like this? put modified(a[s]) into a[s] This might be the best for now. Dar --- Dar Scott

Re: Passing parameters by reference

2012-03-10 Thread Pete
Dick: Thanks for the script, another little nugget of knowledge added to my LC store! I have entered an enhancement request - it's # 10070 Dar: The function in question is a general purpose one that gets called from many places. Sometimes I need to pass an array element and other times just a

Re: Passing parameters by reference

2012-03-10 Thread Dick Kriesel
On Mar 9, 2012, at 5:05 PM, Dar Scott wrote: > Maybe the array could be global (or passed as a parameter) and the subscript > passed. ... There might be problems I don't see right off, such as access to > the same array at two different levels at the same time. Hi, Dar. LC has a way to get a

Re: Passing parameters by reference

2012-03-09 Thread Pete
I have an update on this. If the parameter passed is simply the name of the array with no key qualifications, all is fine. LC only kicks up a fuss when you pass a qualified array like myArray[myKey]. Weird. Pete On Fri, Mar 9, 2012 at 5:05 PM, Dar Scott wrote: > Oh, that would be cool! > > M

Re: Passing parameters by reference

2012-03-09 Thread Dar Scott
Oh, that would be cool! Maybe the array could be global (or passed as a parameter) and the subscript passed. This works: add 1 to a["x"] ... it seems like a reasonable thing to do. There might be problems I don't see right off, such as access to the same array at two different levels at t

Re: Passing parameters by reference

2012-03-09 Thread Bob Sneidar
Yup. You can do something like this: put theArray[1] into theTempArray xyz theTempArray put theTempArray into theArray[1] Bob On Mar 9, 2012, at 3:30 PM, Pete wrote: > I think I already know the answer to this so just confirming in case I'm > missing something > > Let's say I have a handler w

Re: Passing Parameters

2011-11-09 Thread Pete
Thanks for the explanations - stopped me from going down the wrong path. Pete Molly's Revenge On Wed, Nov 9, 2011 at 3:17 AM, Alex Tweedly wrote: > > If you have an existing program that reads from stdin and writes to stdout > - and you want to control / monitor

Re: Passing Parameters

2011-11-09 Thread Björnke von Gierke
Note that these days most OSes will put up a security warning when you start to accept sockets, which you will need to do for inter-process communication. On corporate windows environments, accepting sockets might be disabled altogether for user processes. On 9 Nov 2011, at 12:17, Alex Tweedly

Re: Passing Parameters

2011-11-09 Thread Alex Tweedly
If you have an existing program that reads from stdin and writes to stdout - and you want to control / monitor it from another app - then it'd be natural to just use 'read from process'. Or if you have a program that you don't own / develop you might have to use 'read from process'. In gene

Re: Passing Parameters

2011-11-09 Thread Mark Schonewille
Pete, Most programmes were not written for socket communication. Instead, they write to stdout, which can be read from using the read from process command. Writing to stdout is much easier than writing to a socket. However, if you are writing the app you want to communicate with yourself, then

Re: Passing Parameters

2011-11-08 Thread Pete
Very useful lesson. I guess I'm still interested in the differences/pros/cons of using sockets versus open process/read from process/write to process LC commands (assuming both processes are LC). Do those commands use sockets under the covers? Pete Molly's Revenge

Re: Passing Parameters

2011-11-08 Thread Phil Davis
On 11/7/11 12:47 AM, Phil Davis wrote: If you need to send a message from app1 to app2, and app2 is already running, you could use socket communication between them. Don't have time to pencil it out, but maybe someone else will. If not, I'll do it tomorrow. Phil There is a nice intro to LC s

Re: Passing Parameters

2011-11-07 Thread Phil Davis
On 11/7/11 8:42 AM, Pete wrote: I've never tried the open.read from/write process commands - would those be another way to do this? Yes. See 'open process for neither' in the docs - it accomplishes the same thing as 'launch'. Back in the days when I worked on HP3000 computers, they had som

Re: Passing Parameters

2011-11-07 Thread Phil Davis
Yes! My example was mostly built on a 'lab experiment' model. Phil On 11/7/11 7:52 AM, Richard Gaskin wrote: Phil Davis wrote: On Mac OS X, you can do it from the command line. 1) create a standalone app (named "Untitled1" in this example) that has this stack script: on startup

Re: Passing Parameters

2011-11-07 Thread Pete
I've never tried the open.read from/write process commands - would those be another way to do this? Back in the days when I worked on HP3000 computers, they had something called message files. They were basically files that any number of processes could write to and one process could read from an

Re: Passing Parameters

2011-11-07 Thread Richard Gaskin
Phil Davis wrote: On Mac OS X, you can do it from the command line. 1) create a standalone app (named "Untitled1" in this example) that has this stack script: on startup dispatch $1 to me quit end startup As an example of how to use environment variables that's an e

Re: Passing Parameters

2011-11-07 Thread Mark Schonewille
Hi Cal, You can start up a standalone from the commandline with C:/path/to/standalone.exe param1 param2,... ~/applications/standalone.app param1 param2... In your standalone you can retrieve the values in $1, $2,... anywhere in your scripts: put $1 into fld 1 get item 2 of $2 If your standalo

Re: Passing Parameters

2011-11-07 Thread Phil Davis
If you need to send a message from app1 to app2, and app2 is already running, you could use socket communication between them. Don't have time to pencil it out, but maybe someone else will. If not, I'll do it tomorrow. Phil On 11/7/11 12:28 AM, Phil Davis wrote: On Mac OS X, you can do it fr

Re: Passing Parameters

2011-11-07 Thread Phil Davis
On Mac OS X, you can do it from the command line. 1) create a standalone app (named "Untitled1" in this example) that has this stack script: on startup dispatch $1 to me quit end startup on incoming beep end incoming 2) create a different stack with this

Re: Passing Parameters

2011-11-06 Thread dunbarx
Hi Parameters are passed along with command or function calls. Check the dictionary. Read the entries on "command" and "function". Look up the "params" and "paramCount". Note that there are two methods of passing parameters, by "value" and by "reference". Check the user gude as well. You m