Re: variables and scope
Chris Babcock <[email protected]>
| Newsgroups | gmane.mail.spam.crm114 |
|---|---|
| Organization | Kolonel Panic |
| Message-ID | <[email protected]> |
On Wed, 15 Apr 2009 14:01:55 +0200 Thomas Michael Hagen <[email protected]> wrote: > in gerH builds, variables have scope. this means you can't use a > variable you have defined where you want it; you have to send it > there. That was introduced in BlameBarack. > thus, you need one of two things; either a keyword that labels the > variable as global, or the ability to send more than one variable to a > function call. > > are any of these two things possible in gerH? It all comes down to where the variable is first defined: [usak@cl-t090-563cl bin]$ cat test.crm #!/usr/bin/crm window output /:*:_crm_version:\n/ isolate (:a:) /1/ call /:f:/ output /:*:a:\n/ call /:g:/ output /:*:a:\n/ call /:h:/ output /Then number :*:a: is the first digit in my secret string :*:b:\n\n/ exit :f: alter (:a:) /2/ return :g: isolate (:a:) /3/ return :h: isolate (:b:) /abc4efg/ match [:b:] (:a:) /[[:digit:]]/ return [usak@cl-t090-563cl bin]$ /usr/local/bin/crm test.crm 20080630-BlameVT, rev 3952 (TRE 0.7.5 (LGPL, APPROX, WCHAR, MULTIBYTE)) 2 3 Then number 4 is the first digit in my secret string abc4efg [usak@cl-t090-563cl bin]$ /usr/bin/crm test.crm 20081111-BlameBarack, rev 5002 (TRE 0.7.5 (LGPL, APPROX, WCHAR, MULTIBYTE)) 2 3 Then number 4 is the first digit in my secret string :b: With 'generic' and GerH builds prior to BlameBarack, all variables were global. With BB, a variable declared in the scope of a function is private to that function, but side effects remain on return when a function changes a global variable. > and a more general question: where do i find comprehensive (and > up-to-date) documentation for gerH builds? The changelog on the download is your best source: http://hebbut.net/Public.Offerings/crm114.html Generally I run little laboratory programs like the one above when I want to know about a behavior that seems to be inadequately documented for my purposes. I'm all in favor of applying test-driven development, design patterns, function overloading and other Object Oriented HooHaa to building my CRM scripts. Chris ------------------------------------------------------------------------------ This SF.net email is sponsored by: High Quality Requirements in a Collaborative Environment. Download a free trial of Rational Requirements Composer Now! http://p.sf.net/sfu/www-ibm-com _______________________________________________ Crm114-general mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/crm114-general
signature.asc
(application/pgp-signature, 489 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iQEcBAEBAgAGBQJJ5jNSAAoJEASgqNsqZfCHGWgH/2pxmmAVT90Wt5/me5NLppcn jy8FLuwgi+fFw2AaiEvfjB6Yq/qwFPAJBQevfb1LYdQNErfHWwdIebeNDKlwpCNK J0f0YJKPUeF4GgwdJJRJNUGq5sSFUTV7v2Ee1FcM8FTt3y5idMAg3ajxkBq2FpIk 5cVrj8+r4Skk7hJ2ls4U2g+2zk8Z/KSmwmQqL8xn1cNDCiB31jkISFt7Dn5TEAKp LLYWI2CjLOmziVXHbcbKmBt3u3iKonPIT/hCjTFJ5iXCyUYWMHcVCW97mNsnYdgJ cNHweNJtDSEKz/pVPi8iTA2zPRUDOeF4BIcIOAosnRt3hZH80OuEcsJ54S/edLo= =bn4L -----END PGP SIGNATURE-----