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

Enhance dot notation to allow nested expressions #7

Open
birchb1024 opened this issue Jun 20, 2020 · 1 comment
Open

Enhance dot notation to allow nested expressions #7

birchb1024 opened this issue Jun 20, 2020 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@birchb1024
Copy link
Owner

birchb1024 commented Jun 20, 2020

Consider this case:

define:
  $data1:
      atom1: 12
      atom2: 13
  $data2:
      items: 
           atom2
---
$data1,$data2.items

We get an error

Error: Subvariable value { items : atom2  } for not string or int in $data1.$data2.items

because this is being interpreted as `$data1,($data2).items.atom2

The workaround is to declare an intermediate variable:

define:
  $data1:
      atom1: 12
      atom2: 13
  $data2:
      items: 
           atom2
---
define:
   $inter:  $data2.items
---
$data1.$inter

This enhancement is to add sub-expressions to make the evaluation order explicit such as

$data1.[$data2.items]

Thereby eliminating the intermediate variable.

@birchb1024 birchb1024 added the enhancement New feature or request label Jun 20, 2020
@birchb1024 birchb1024 self-assigned this Jun 20, 2020
@birchb1024
Copy link
Owner Author

birchb1024 commented Jun 20, 2020

This is a good idea because it saves programmer time. However, I had a look at the code changes needed - I will need a proper parser for dot notation, not just a string.split(). Let me know how important this enhancement is to you...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant