Function/variable scope (pass by value or reference?)

You guessed right, table variables are passed by reference. Citing Lua 5.1 Reference Manual: There are eight basic types in Lua: nil, boolean, number, string, function, userdata, thread, and table. …. Tables, functions, threads, and (full) userdata values are objects: variables do not actually contain these values, only references to them. Assignment, parameter passing, and … Read more

What is the difference between a constant and a static variable and which should I choose?

Mutability A constant in Rust is immutable. You neither can reassign nor modify it: struct Foo(u32); const FOO: Foo = Foo(5); const mut FOO: Foo = Foo(5); // illegal fn main() { FOO = Foo(1); //illegal FOO.0 = 2; //illegal } A static variable can be mutable and therefore can either be modified or reassigned. … Read more

setq and defvar in Lisp

There are several ways to introduce variables. DEFVAR and DEFPARAMETER introduce global dynamic variables. DEFVAR optionally sets it to some value, unless it is already defined. DEFPARAMETER sets it always to the provided value. SETQ does not introduce a variable. (defparameter *number-of-processes* 10) (defvar *world* (make-world)) ; the world is made only once. Notice that … Read more

When should I quote CMake variables?

Two principles of CMake you have to keep in mind: CMake is a script language and arguments are evaluated after the variables are expanded CMake differentiates between normal strings and list variables (strings with semicolon delimiters) Examples set(_my_text “A B C”) with message(“${_my_text}”) would give A B C set(_my_list A B C) with message(“${_my_list}”) would … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)