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

Variable references inside sequences may not be working #25

Open
alganet opened this issue Apr 3, 2012 · 6 comments
Open

Variable references inside sequences may not be working #25

alganet opened this issue Apr 3, 2012 · 6 comments
Milestone

Comments

@alganet
Copy link
Member

alganet commented Apr 3, 2012

Needs some tests, but it seems that something like foo = [[baz]] isn't expanding the baz variable properly. Output should be something compatible to $container->foo = array($container->baz).

@alganet
Copy link
Member Author

alganet commented May 6, 2012

I've imagined a fix for this.

  • Container::getItem() should work lazy loading only Instantiators
  • When setting a closure to Container, it should be converted to an instantiator
  • When getting an item, if this item is Traversable, Container should traverse and lazy load all Instantiators inside.

This would probably fix another issues we had with lazy loading.

@iannsp
Copy link
Contributor

iannsp commented Sep 5, 2012

I did a PR for this issue but it not solve the problem inside #25 as well.

The goal here is nested interpretation as fallow
[[N]] = we have a variable variable, so ,

(a)
A = 'datum'
N = A
foo = [[N]] => [[N]] => [A] => 'datum'

but the issue ask for something like

(b)
[[N]] = we have a variable variable, so ,
A = 'datum'
N = A
foo = [[N]] => [[N]] => array('datum');

use the operators [] for both things(indicate array and variable association) generate this sort of mistake.

from the INI(and parse_ini ) point of view the (b) is more interesting, but from the PHP point of view I think the (a) have more "common sense" inside.

anyway,
I will proper implement it.

@nickl-
Copy link
Member

nickl- commented Sep 18, 2012

Yes left assign makes more sense, or are we speaking about something else?

Scratching head

@nickl-
Copy link
Member

nickl- commented Feb 8, 2013

@Respect Does anyone know what happened for PR #32 to be revoked? Is this not solving the issue?

@alganet
Copy link
Member Author

alganet commented Feb 8, 2013

I believe the PR was related to making a distinction between [] for declaring and using. I can't really remember, but I disagree we should separate the syntax.

The [bracket syntax] stands for a configuration block. If used before = is declaration, if used after = is passing, much similar to what $ does for variables in PHP.

@nickl-
Copy link
Member

nickl- commented Feb 8, 2013

I am looking at #20 now and started wondering if we shouldn't make a better distinction between arrays and references (iow lookup to another declared value.) perhaps using an @ or as seems quite universal the use of $ to denote a reference or that it carries a defined meaning otherwise. Instead of using the [ ] which are ambiguous to i.) section names, ii.) array definitions, iii.) something I am forgetting.

This will solve the issue by means of:

[baz]
baz = 'me baz'
foo = [$baz]

Will give the result for foo as array("me baz")

Thoughts? Any motivations why we are using the [ ] brackets instead?

@augustohp augustohp added this to the 2.1 milestone Dec 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants