Attempt to modify a frozen value

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Attempt to modify a frozen value

Jono-2
Hi guys, I'm smacking my head against a brick wall on this one.  
Modifying an existing tag, adding in some functionality.

The parameter "pageThrough_extra" is an optional param, and I have  
all the usual code
        !(local_defined('pageThrough_extra'))? local('pageThrough_extra' =  
string);

However I have added in a switch to modify #pageThrough_extra if  
another param is true, and it's throwing this error if the tag is  
passing -pageThrough_extra='' (the value being fed to  
pageThrough_extra is calculated so it is possible to have it being  
empty):

Attempt to modify a frozen value. The value was "" of type "string". (=)

Surely a param's local can be modified! It doesn't make sense to me  
that it can't!

LP8.5, haven't tried it on 8.1.x

Jono

// ---------------------------------------------------------
/*
     Jonathan Guthrie
     xServe Ltd, Wellington NZ
     [hidden email]   |   http://xserve.co.nz
     DDI +64 4 978 7388   |   Mob +64 21 678890

*/
// ---------------------------------------------------------



============================================
Attend the Lasso Summit
March 2-7, 2007 in Fort Lauderdale, FL
http://www.LassoSummit.com/
============================================

------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: Attempt to modify a frozen value

Adam Randall-2
Add -copy to your tag definition:

define_tag(
        ...
        -optional = 'pageThrough_extra',
        -copy,
        ...);

If you don't specify -copy, it will attempt to use the value as a reference. Because of this, Lasso is attempting to modify a constant (empty string), and because it's constant, it fails and you get that error.

Here's an example:

[
var('x' = 1);
define_tag('mytag', -optional = 'x');
  #x += 1;
/define_tag;
mytag($x);
$x;
]

You will get 2 as the result.

But, if you add copy:

[
var('x' = 1);
define_tag('mytag', -optional = 'x', -copy);
  #x += 1;
/define_tag;
mytag($x);
$x
]

The result will be 1.

HTH,

Adam.

On Wed, 20 Dec 2006 22:58:19 +1300, Jono wrote:

> Hi guys, I'm smacking my head against a brick wall on this one.
> Modifying an existing tag, adding in some functionality.
>
> The parameter "pageThrough_extra" is an optional param, and I have
> all the usual code
> !(local_defined('pageThrough_extra'))? local('pageThrough_extra' = string);
>
> However I have added in a switch to modify #pageThrough_extra if
> another param is true, and it's throwing this error if the tag is
> passing -pageThrough_extra='' (the value being fed to
> pageThrough_extra is calculated so it is possible to have it being
> empty):
>
> Attempt to modify a frozen value. The value was "" of type "string". (=)
>
> Surely a param's local can be modified! It doesn't make sense to me
> that it can't!
>
> LP8.5, haven't tried it on 8.1.x
>
> Jono
>
> // ---------------------------------------------------------
> /*
>     Jonathan Guthrie
>     xServe Ltd, Wellington NZ
>     [hidden email]   |   http://xserve.co.nz
>     DDI +64 4 978 7388   |   Mob +64 21 678890
>
> */
> // ---------------------------------------------------------
>
>
>
> ============================================
> Attend the Lasso Summit
> March 2-7, 2007 in Fort Lauderdale, FL
> http://www.LassoSummit.com/
> ============================================
>
> ------------------------------
> Lasso Support: http://support.omnipilot.com/
> Search the list archives: http://www.listsearch.com/lassotalk.lasso
> Manage your list subscription:
> http://www.listsearch.com/lassotalk.lasso?manage

--
-----------------------------------------------------------------------
Adam Randall                                       http://www.xaren.net
[hidden email]                                   AIM/iChat:  blitz574

"Macintosh users are a special case. They care passionately about the
Mac OS and would rewire their own bodies to run on Mac OS X if such a
thing were possible." -- Peter H. Lewis

============================================
Attend the Lasso Summit
March 2-7, 2007 in Fort Lauderdale, FL
http://www.LassoSummit.com/
============================================

------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: Attempt to modify a frozen value

Viaduct Productions
In reply to this post by Jono-2
local('pageThrough_extra' = (!(local_defined('pageThrough_extra'))?  
string | null));

If you don't qualify, you haven't instantiated at all.  Perhaps that  
is it?

On Dec 20, 2006, at 4:58 AM, Jono wrote:

> The parameter "pageThrough_extra" is an optional param, and I have  
> all the usual code
> !(local_defined('pageThrough_extra'))? local('pageThrough_extra' =  
> string);
>
> However I have added in a switch to modify #pageThrough_extra if  
> another param is true, and it's throwing this error if the tag is  
> passing -pageThrough_extra='' (the value being fed to  
> pageThrough_extra is calculated so it is possible to have it being  
> empty):
>
> Attempt to modify a frozen value. The value was "" of type  
> "string". (=)
>
> Surely a param's local can be modified! It doesn't make sense to me  
> that it can't!


============================================
Attend the Lasso Summit
March 2-7, 2007 in Fort Lauderdale, FL
http://www.LassoSummit.com/
============================================

------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage