Enhanced syntax for NEON hashes

Notice: This thread is very old.
David Grudl
Nette Core | 8228
+
0
-

In Neon it is not possible to write this:

- item:
  - sub
  - sib

You have to do:

-
  item:
    - sub
    - sib

What is benefit? In config you can write:

services:
	- App\Helpers\LangResolver:
		- setup: ...
		- autowired: off

It would be nice if this will be possible too:

services:
	- App\Helpers\LangResolver(args, ...)
		- setup: ...
		- autowired: off
Vojtěch Dobeš
Gold Partner | 1316
+
0
-

Sir, you read my mind before I read it.

Tomáš Votruba
Moderator | 1114
+
0
-

Comes really handy.

mkoubik
Member | 728
+
0
-

Maybe I don't get it but what would be the new syntax for

people:
	-
		name: John
		age: 25
	-
		name: Jane
		age: 42

?

Tomáš Votruba
Moderator | 1114
+
0
-

@mkoubik: I guess this would remain the same.

Filip Procházka
Moderator | 4668
+
0
-

I would love this syntax

services:
	App\Helpers\LangResolver(args, ...):
		setup: ...
		autowired: off
Vojtěch Dobeš
Gold Partner | 1316
+
0
-

What I would personally love to see possible (my often usecase):

services:
	- App\Helpers\ILangResolverFactory
		create: class(%defaultLang%)
		parameters: [defaultLang]

class is magic placeholder for real name that the factory creates according to @return annotation. Using parameters for generated factories always ends in duplicating the @return annotation.

Last edited by vojtech.dobes (2014-02-13 14:12)

David Matějka
Moderator | 6445
+
0
-

@vojtech.dobes: Now you can set only arguments without class (create),

services:
	-
		implement: App\Helpers\ILangResolverFactory
		arguments: [%defaultLang%]
		parameters: [defaultLang]

So with this enhancement it will be only

services:
	- App\Helpers\ILangResolverFactory
		arguments: [%defaultLang%]
		parameters: [defaultLang]
Vojtěch Dobeš
Gold Partner | 1316
+
0
-

matej21 Yeah, I thought so but I was waiting for confirmation :). Great job!

hrach
Member | 1838
+
0
-

+1

Pavel Macháň
Member | 282
+
0
-

+1

I hate this empty line

-
  item:

Last edited by EIFEL (2014-02-14 00:19)

David Grudl
Nette Core | 8228
+
0
-

mkoubik wrote:

Maybe I don't get it but what would be the new syntax for..

This should be valid, but only for indentation using spaces :-(

people:
	- name: John
	  age: 25
	- name: Jane
	  age: 42