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

Support for easily carrying variables into a sub-scope #140

Open
msprotz opened this issue Sep 17, 2021 · 2 comments
Open

Support for easily carrying variables into a sub-scope #140

msprotz opened this issue Sep 17, 2021 · 2 comments
Assignees
Labels
🔧 compiler Issue concerns the compiler ✨ enhancement New feature or request 💡 language Language design

Comments

@msprotz
Copy link
Contributor

msprotz commented Sep 17, 2021

Ideally, I would like things to look like this:

declaration scope Test1:
  context taxpayer scope TaxPayer
  context return scope TaxReturn
  # This kind of mechanism should be limited to those variables of the
  # sub-scopes that have been marked as input.
  context section108d3 scope Section108d3 with taxpayer, taxreturn
  context section61a scope Section108d3 with taxpayer = taxpayer1, taxreturn = taxreturn1

with the syntactic "pun" being allowed only if the names match

this would
i) save a tremendous amount of verbosity later on, and
ii) set these relationships as being "immutable" (because they're declared in the preamble), which is good, because such links are not intended to be overridden later on with an exception

it would be great to also make sure that this easy replication of variables into a sub-scope is only for those variables marked as inputs (see #112

Thanks,

Jonathan

@denismerigoux denismerigoux added ✨ enhancement New feature or request 💡 language Language design 🔧 compiler Issue concerns the compiler labels Sep 24, 2021
@AltGr AltGr self-assigned this Oct 17, 2022
@AltGr
Copy link
Contributor

AltGr commented Oct 17, 2022

This should be merged into the discussion for #277: we probably want a similar syntax for calling scopes as subscopes like here, and as function calls like in #277.

@denismerigoux
Copy link
Contributor

Good remark. We could do something like this to declare all the arguments to a sub-scope call at once:

declaration scope Test1:
  context taxpayer scope TaxPayer
  context return scope TaxReturn
  # This kind of mechanism should be limited to those variables of the
  # sub-scopes that have been marked as input.
  context section108d3 scope Section108d3 with taxpayer, taxreturn
  context section61a scope Section108d3 with taxpayer = taxpayer1, taxreturn = taxreturn1

scope Test1:
   definition section108d3 of { 
     -- taxpayer : taxpayer
     -- taxreturn: taxreturn
   }
   definition section61a of {
     -- taxpayer : taxpayer1
     -- taxreturn: taxreturn1
   }

If you define all the arguments at once, can you also redefine them with things like this later on?

scope Test1:
  exception definition section61a.taxpayer under condition foo is True equals taxpayer2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔧 compiler Issue concerns the compiler ✨ enhancement New feature or request 💡 language Language design
Projects
Status: Inactive
Development

No branches or pull requests

3 participants