-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

many thanks for your answer, indeed, it's just what I needed, and you
made it very simple to use! I wasn't sure *ref* was a real pointer
allocator so I played with variable definition scope and nested
procedures, and that combination appears to also provide that kind of
functionality. But now that I know how it works let's try some :)

Kudos.

On 31/07/2011 20:42, Romain Beauxis wrote:
> Hi!
> 
> 2011/7/30 okay_awright <[email protected]>:
>> I've got a specific question related to how Liquidsoap scripts work.
>> I'd like to 'propagate' an updated value from outside the definition of
>> a function, and not rely on global variables.
>> I was wondering how the *ref* keyword works, is it used to support
>> C-like pointers? I can't find the specific help page right now.
>> Say I've got a function "dummy_procedure" and I'd like to 'export' a
>> variable from outside the scope of this function, the caveat is that the
>> return value is already used for something else.
>> Can I use the *ref* keyword somehow to avoid composite return values
>>        def dummy_procedure(_ref_x) =
>>                _ref_x = 5
>>                7
>>        end
>>        x = 4
>>        ref_x = ref x;
>>        y = dummy_procedure(ref_x)
>> or should I use lists or maps to return both x and y from
>> dummy_procedure at the same time?
> 
> Variable references works as follows:
> # Setup a reference
> x = ref 1234
> 
> # Update the reference
> x := 4567
> 
> # Retrieve the reference
> y = !x
> 
> Does that answer your question?
> 
> Cheers,
> Romain

- -- 
best regards,

okay_awright
<okay_awright AT ddcr DOT biz>
[PGP key on request]
-----BEGIN PGP SIGNATURE-----

iQEcBAEBAgAGBQJONaTzAAoJEN2X/7ng71pT4bkH/iizYC4w8Pa6jo+2ZYgML6Xh
z0JaPKykVC0R8hrEhX1LvOIYlrBEA8hhaCvtJX0TLUSnxaB4tL/lUpDjkOJHPqPF
1it9du136fwlod4zeF1RlWwa30K5FmBFZA25t2+W/RS8Ka5+cMRP42ZEVFv7LPw3
/pb5EyJVmx5cD1J7xl71OmSYjX6tchpq0LDXsTBqoPufkn44WaAsMPRU4EC81RnA
H3dsSwTxt6CE/SHHqfNLxAbqaIIg4hP406LGlgMC7Hh/tMUdIp0K79GNFNSDncEv
et+iT73Tn8XNMSDgsXNcqZ/q7ZC8KwOG7tQ9KaHL3iuvwUQjGLOJWKrol6L8A08=
=SDE4
-----END PGP SIGNATURE-----

------------------------------------------------------------------------------
Got Input?   Slashdot Needs You.
Take our quick survey online.  Come on, we don't ask for help often.
Plus, you'll get a chance to win $100 to spend on ThinkGeek.
http://p.sf.net/sfu/slashdot-survey
_______________________________________________
Savonet-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/savonet-users

Reply via email to