Pass by parameter

What is Pass by Parameter and Pass by value in simple terms ?

Hi! Welcome to the forum.

I've never heard of "pass by parameter" so I'm going to assume it means the same as "pass by name."

Pass by value is what Snap! does, and what most other languages do also. When you call a procedure that takes an input, the value of that input is computed, and passed into the called procedure. That procedure has no way of knowing how the input was computed, and if it changes the value of its parameter (the variable inside the procedure that holds the input value) that has no effect on the outside world.

Side note: If the input value is itself a mutable structure (a list, in Snap!) and the called procedure mutates that structure, the change is visible outside the procedure. Tell me if I need to explain this.

Call by name is sort of like what macros do in some languages. The input expression is inserted into the called procedure, replacing each use of the corresponding formal parameter inside the procedure. The resulting expression is evaluated in the caller's environment. Except for macros, nobody really does call by name. Instead some languages have call by reference, which means that the actual argument expression in the caller must be a variable name; the formal parameter in the called procedure is made to point to the same variable. Upvars in Snap!, such as the index variable in a FOR block, use call by reference.

If this is too abstract, ask a question with examples.

P.S. Moving this thread to the "computer science" category.

Judging by your definitions of name and reference, "pass by parameter" is what we call "pass by reference" in this neck of the woods.

yes, it should be pass by reference. Will it be an address of list ?

pass by reference is making the pointer correct,pass by value is making a new pointer and passing the value

The address of a Snap! List data structure, which in turn includes either a pointer to a Javascript array or a Lisp-style car/cdr pair at the head of a linked list.

Is this what unevaluated inputs do?

Yes, precisely.