systemds icon indicating copy to clipboard operation
systemds copied to clipboard

[FUTURE][SYSTEMML-2078] Add support for global variables

Open EdgarLGB opened this issue 7 years ago • 7 comments

Hi, Here is a PR for adding support of global variables. We can define variables in global scope or function scope. For a function call, it can reference variables from its parent scope, i.e., global or its superior function scope.

Thanks for review

EdgarLGB avatar Apr 02 '18 13:04 EdgarLGB

Can an Admin verify this patch?

akchinSTC avatar Apr 02 '18 13:04 akchinSTC

Sorry for the late response but I would like to play around with this a bit before doing the review. I'll come back to this in a few days.

mboehm7 avatar Apr 06 '18 01:04 mboehm7

@EdgarLGB things look good :). Tested global-variables-test.dml.

I was wondering why you choose to use + operator instead of a function call.

Eg:

gv = 10
setglobal(gv) or
global gv

krishnakalyan3 avatar May 16 '18 08:05 krishnakalyan3

Thanks @krishnakalyan3 for testing! In fact, my idea is to define a global variable and check if it is modified after the function call which tries to modify the global variable. And I'm not sure that I understand your question. Well, I used it for concatenating the string.

EdgarLGB avatar May 17 '18 16:05 EdgarLGB

@EdgarLGB thanks for the clarification.

krishnakalyan3 avatar May 17 '18 17:05 krishnakalyan3

Hi @Baunsgaard and @kev-inn , would you investigating this PR. Is this changeset in line with systemds direction.

cc @EdgarLGB

j143 avatar Apr 28 '20 13:04 j143

Meanwhile, I think not supporting global variables might be better in the long run as it keeps functions (except for explicit reads/writes) side-effect free. Back when discussing this feature, it included two sub problems (1) builtin global constants like NaN, PI, INF, as well as (2) different function scoping rules (with global access). Since (1) has already been introduced (see https://github.com/apache/systemml/commit/4a822a22c88b579e935a1b09051c1fe236e18a4b) and meanwhile we extended the list functionality to pass parameters easier along function call graphs, there is no more a real need for globals. However, I would leave this PR open, in case we come back to it - then this would be an excellent starting point.

mboehm7 avatar May 01 '20 19:05 mboehm7