Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[dev.icinga.com #8074] Figure out how variable scopes should work #2429

Closed
icinga-migration opened this issue Dec 11, 2014 · 8 comments
Closed
Labels
area/configuration DSL, parser, compiler, error handling blocker Blocks a release or needs immediate attention enhancement New feature or request
Milestone

Comments

@icinga-migration
Copy link

This issue has been migrated from Redmine: https://dev.icinga.com/issues/8074

Created by gbeutner on 2014-12-11 21:10:01 +00:00

Assignee: gbeutner
Status: Closed (closed on 2015-01-12 13:49:26 +00:00)
Target Version: 2.3.0
Last Update: 2015-02-13 06:46:15 +00:00 (in Redmine)


http://en.wikipedia.org/wiki/Scope\_%28computer\_science%29#Dynamic\_scoping

Changesets

2014-12-13 16:48:58 +00:00 by gbeutner dd4c04a

Implement the 'global' keyword to differentiate between variable scopes

refs #8074

2014-12-14 10:33:45 +00:00 by gbeutner 1cb0231

Refactor how variable scopes work

refs #8074

2014-12-14 10:55:44 +00:00 by gbeutner b40e95d

Only implicitly convert strings to indexers

refs #8074

2014-12-14 13:08:41 +00:00 by (unknown) 262bfb7

Allow if/else in rterms

refs #8074

2014-12-15 05:02:59 +00:00 by (unknown) 343d46b

Make sure IcingaApplication::GetVars returns a default value

refs #8074

2014-12-15 05:03:13 +00:00 by (unknown) 8c9fdb5

Remove unused code

refs #8074

2014-12-15 11:58:55 +00:00 by gbeutner 252f320

Fix incorrect variable scoping

refs #8074

2014-12-15 14:12:24 +00:00 by gbeutner dcaad50

Fix unit test

refs #8074

2014-12-15 15:09:17 +00:00 by gbeutner 77806b9

Get rid of the local/global keywords

refs #8074

2014-12-15 15:42:34 +00:00 by (unknown) b9831f0

Add unit tests for the "var" keyword

refs #8074

2014-12-15 16:23:18 +00:00 by (unknown) d72bd4f

Add another unit test for expressions

refs #8074

2014-12-16 09:37:21 +00:00 by gbeutner 0724c0c

Update unit tests to use the new variable syntax

refs #8074

Relations:

@icinga-migration
Copy link
Author

Updated by gbeutner on 2014-12-12 05:20:58 +00:00

This would allow us to easily pass a macro() function to macro expressions.

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2014-12-12 09:49:20 +00:00

  • Priority changed from Normal to High

@icinga-migration
Copy link
Author

Updated by gbeutner on 2014-12-13 16:49:29 +00:00

  • Subject changed from Figure out whether we want dynamic scoping for VMFrame to Figure out how variable scopes should work

@icinga-migration
Copy link
Author

Updated by gbeutner on 2014-12-15 10:22:28 +00:00

The main problem is that assignments in objects must bind to the "current" scope as opposed to the local scope. I.e. in the following example the assignment in the inner dict assigns to the inner dict:

object Host "localhost" {
  check_command = 3

  vars.interfaces.eth0 = {
    check_interval = 30
  }
}

This is obviously what people expect for Icinga. However for functions this is somewhat counter-intuitive:

function test() {
  local a = 3

  a = 7 // This assigns to this.a
}

One thing we could do is to only use BindToScope() in objects and apply.

@icinga-migration
Copy link
Author

Updated by gbeutner on 2014-12-15 10:33:48 +00:00

Hm, this would break:

function f() {
  return  {
    v = 3
  }
}

@icinga-migration
Copy link
Author

Updated by icinga-kanban on 2014-12-15 15:12:01 +00:00

Build !#370 triggered by commit 928bf63 passed successfully.

Branch: origin/master
Author: Gunnar Beutner

@icinga-migration
Copy link
Author

Updated by gbeutner on 2014-12-18 16:25:39 +00:00

  • Relates set to 7774

@icinga-migration
Copy link
Author

Updated by gbeutner on 2015-01-12 13:49:26 +00:00

  • Description updated
  • Status changed from New to Closed

@icinga-migration icinga-migration added blocker Blocks a release or needs immediate attention enhancement New feature or request area/configuration DSL, parser, compiler, error handling labels Jan 17, 2017
@icinga-migration icinga-migration added this to the 2.3.0 milestone Jan 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/configuration DSL, parser, compiler, error handling blocker Blocks a release or needs immediate attention enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant