Difference between tablename with and without backtick

I understand the difference when it comes to delete and update. But that’s the underlying difference of the table reference with/wo backtick?
Say, why should I pass `table, instead of table to a function?

Example:

autofill:{[tname;a;b] tname insert (a;b)}

t:( a:symbol$(); b:int$())

autofill[t; foo; 100]

Sry if the question is trivial but I’m really getting confused as come from C++/Java.

Similar to pass by value and pass by reference in C++.

If you only want to perform calculation on table data without modifying it, pass the table value

If you want to update the underlying table, pass the table reference

In your example

Wo Backtick e.g. ( a: …) -  Pass by value - returns updated value but does not modify anything 

With backtick e.g. t - Pass by reference - changes to t persists, modified by function call.


From: personal-kdbplus@googlegroups.com <personal-kdbplus@googlegroups.com> on behalf of Echo Liu <liu.yuja@gmail.com>
Sent: 30 July 2016 20:37:18
To: Kdb+ Personal Developers
Subject: [personal kdb+] Difference between tablename with and without backtick
 

I understand the difference when it comes to delete and update. But that’s the underlying difference of the table reference with/wo backtick?
Say, why should I pass `table, instead of table to a function?

Example:

autofill:{[tname;a;b] tname insert (a;b)}

t:( a:symbol$(); b:int$())

autofill[t; foo; 100]

Sry if the question is trivial but I’m really getting confused as come from C++/Java.


Submitted via Google Groups

t insert x is like a,x
q)a:1 1 1
q)a,2
1 1 1 2

`t insert x is like a,:x
q)a,:2
q)a
1 1 1 2