[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANN] Reactive Server Pages
- From: "Francisco Sant'anna" <francisco.santanna@...>
- Date: Thu, 5 Aug 2010 23:55:14 -0300
Thanks for the feedback!
I am thinking of separating a special environment only for the public interface with the client.
-- put here all the variables the client can change
pub = {
_name = ''
}
Writing to undefined variables raises an error (thanks Chris).
In protected code, you can write a kind of "reactive validation":
local _assert = L(assert)
local _type = L(type)
_protected_name = _assert(EQ(_type(pub._name), "string"))
_html = "My name is " .. _protected_name
For instance, `_html` would not be public.
This thread convinced me that "global by default" is not the way for RSP. :)
--
Francisco Sant'Anna
http://www.lua.inf.puc-rio.br/~francisco/