Page 1 of 1

Do unused variables and sigle underscore variables consume less memory than ordinary variables?

Posted: 14 Feb 2015 12:45
by Ferenc Nagy
Let me ask something else about the code block in my previous post.
Variant#1.

Code: Select all

clauses     iniHiLo(Range_List) :-         Range_List =             [ Range ||                 Axis in applied_view:all_                 applied_view:range_map_fact:tryGet(Axis):view:g(Axis,Verb,R1,R2)             ].
RangeList is used later.

Variant#2.

Code: Select all

clauses     iniHiLo() :-         _Range_List =             [ Range ||                 Axis in applied_view:all_axes,                 applied_view:range_map_fact:tryGet(Axis):view:g(Axis,Verb,R1,R2)             ].
_RangeList is an unused variable.

Variant#3.

Code: Select all

clauses     iniHiLo() :-         _ =             [ Range ||                 Axis in applied_view:all_axes,                 applied_view:range_map_fact:tryGet(Axis):view:g(Axis,Verb,R1,R2)             ].
The list-type result of the [||] block is passed to the unnamed and unused variable.
Will this variant consume less memory than the others?

Posted: 14 Feb 2015 21:49
by Thomas Linder Puls
They will all use the same.