bem / bem-core

BEM Core Library
https://ru.bem.info/technologies/classic/i-bem/
Other
275 stars 94 forks source link

Don't change api of BEMTREE in v3 #1107

Closed apsavin closed 8 years ago

apsavin commented 9 years ago

Guys, we've changed api of BEMTREE in 3.0 because I wanted to handle errors. I think, we should restore it back before official publication of 3.0.

Why?

How?

We should implement some option like strict: true. It may be false by default.

  1. It will allow ignore errors for people who want to do so.
  2. It will allow to handle errors properly for those who want
  3. It will allow to ignore errors in production environment

What do you think about this proposal? If you agree, can you suggest me the way how to implement such option?

apsavin commented 9 years ago

@veged ? @narqo ?

narqo commented 9 years ago

My opinion there's nothing wrong about fixing wrong decisions that were implemented centaurs ago. I don't understand what kind of consistency with BEMHTML you're talking about.

I think promises gives you ability to make all kinds of decisions you've listed. You still can use bemtree.apply().always(/* i don't give a fck about errors */) don't you?

apsavin commented 9 years ago

My opinion there's nothing wrong about fixing wrong decisions that were implemented

Exactly what I'm talking about.

Of course, users can now ignore errors or handle them.

I just don't like the way how and I think we can change it before release.

The main thought is: "strict" option and BEMTREE.apply().then(onF, onR) is better then BEMTREE.apply().spread(function(bemjson, promise){ return promise.done(function (){onF(bemjson);}, onR);}).

narqo commented 9 years ago

Oh, now I see. I was absolutely sure that we already have such strict behaviour in v3. We need to drop this spread requirements from v3, and start using normal promises there. No additional options are needed.

veged commented 9 years ago

speaking about v3 we can do such API changes — :+1:

we just need to ensure about documentation in changelog

dfilatov commented 8 years ago

Let's move all discussions about BEMTREE and BEMHTML to https://github.com/bem/bem-xjst/issues