RFC: general splitting nette

5 years ago

hrach
Member | 1817
+
0
-

This is about general splitting. There are some parts which are implemented so closely, we must split them.

  1. Exceptions I think it's good to have some reason to introduce BC breaks to distinguish exception for packages such Nette\Database + Nette\Latte to have own InvalidArgumentException. From my point of view – no problem here.
  2. Nette Extension It's getting complicated. There is no problem in introducing a new extension, however, there is some copy paste for validation. Also some need to write it BC, but, from my point of view – no big problem here.
  3. Nette Loader This smell to much. It's clear that each package has to have own Loader, but from my point of view – it's too much copy paste and I'm also not sure, if there is not another better way.

Comments? Thanks.

5 years ago

Filip Procházka
Moderator | 4693
+
0
-

If it were onto me, I'd drop autoloaders completely (except robotloader) and supported only composer. So you could either use Robotloader on Nette or composer.

5 years ago

enumag
Member | 2128
+
0
-

Nette Extension should be split into several extensions. The only problem is using the configuration from nette: section for BC. Currently it's afaik impossible to read configuration of different extension.

Nette Loader should be removed completely and autoloading should be done using PSR-0 or better yet PSR-4. I prefer composer-only solution but it would be easy to add a loader.php file to each package. Also I'm not really a fan of exceptions.php files.

5 years ago

Jan Tvrdík
Nette guru | 2559
+
+1
-

Please note that one of the important point in splitting is to make standalone usage easier. Using Latte standalone now requires about 28 lines of code. Removing NetteLoader would make this much longer. Using PSR-4 requires most of all to put exceptions to a separate namespace.

5 years ago

Filip Procházka
Moderator | 4693
+
0
-

Fuck stupid FIG and their PSR, exceptions.php file is great.

5 years ago

enumag
Member | 2128
+
0
-

Removing NetteLoader would make this much longer.

Why do you think so? All you need is require 'vendor/autoload.php; if you're using composer. Are you against composer-only solution? If so as I said it's easy to prepare loader.php file with the PSR-4 autoloading behaiviour for every package. Then you just need require 'libs/Latte/loader.php;. In both cases it's actually shorter than your example.

Using PSR-4 requires most of all to put exceptions to a separate namespace.

@hrach already mentioned that. I don't see any problems here.

5 years ago

xificurk
Member | 119
+
0
-

NetteExtension: Nette extension should look for the deprecated options and if it finds some, it can issue deprecation warning and then register appropriate new extension and adjust its defaults with the found configuration options in ‘nette:’ section.

Nette Loader: +1 for removal and replacing it with PSR-0/4.

5 years ago

Jan Tvrdík
Nette guru | 2559
+
+1
-

enumag wrote: Are you against composer-only solution?

Yes. You should be able to use Latte without knowing anything about OOP, MVC or Composer. It should be so easy to use that it would make no sense not to use it! =)

5 years ago

mishak
Member | 100
+
0
-

Is there any guidance regarding versioning of splitted packages?

Currently all of them have v2.2 tag which is ok i guess. But how will it progress from now on?

I am asking because it is not just composer that is affected by it yes I am talking about bower. Now it is complete mess. I won't go into much detail. (Somewhere is ~0.0.3; in nette/forms is explicit version 2.1.0 (even in tag v2.2).)

Split script from form to bower-form; use library version instead of explicit one. Just solve it somehow please.

EDIT: And I hope future versions won't be based on Nette releases.

Last edited by mishak (2014-04-30 02:27)

5 years ago

enumag
Member | 2128
+
0
-

Well if the packages are supposed to have different version numbers tha nette/nette in the future, they should begin from 1.0 in my opinion. If the numbers will differ later anyway there is no reason for them to match now. It will only cause confusion.

Last edited by enumag (2014-04-30 09:43)

5 years ago

David Grudl
Nette Core | 6864
+
0
-

Splitting is done in v2.2. Each package will have its own versioning.