pharo-spec / Spec

Spec is a framework in Pharo for describing user interfaces.
MIT License
61 stars 63 forks source link

introduce displayBlock and deprecate display. #1500

Closed Ducasse closed 8 months ago

Ducasse commented 9 months ago

This is a block and not a display that we get!

estebanlm commented 8 months ago

Stef, please don't. This is not a good change . Some years ago we decided to drop the block suffix in purpose and favour just "display:". The rationale is that it makes a whole family of accessors play better together, and also... is not just a "block" what you should pass there but any valuable.

This changes makes everything more dirty.

estebanlm commented 8 months ago

I will revert this PR

estebanlm commented 8 months ago

Stef, please don't. This is not a good change . Some years ago we decided to drop the block suffix in purpose and favour just "display:". The rationale is that it makes a whole family of accessors play better together, and also... is not just a "block" what you should pass there but any valuable.

This changes makes everything more dirty.

also, the idea is that you will set what is going to be display. We don't care the nature of the parameter :)

Ducasse commented 8 months ago

Your API is not good. display is not a good API, display: is not a good API. But you do not listen to your users, else you would ask them.

And display is an order and it conflicts with the display. You see at the end I do not care but this has also consequences.

Ducasse commented 8 months ago

And BTW I do not see any evidence about

he rationale is that it makes a whole family of accessors play better together, and also... is not just a "block" what you should pass there but any valuable.

We can always pass a valuable instead of a block so this is a non argument.

Ducasse commented 8 months ago

With this kind of design it means that we have to constantly check the code to be able to pass an argument. It looks like glamour APIs. Always guessing. Now I do not care but I will not document this .

Ducasse commented 8 months ago

You see this design

displayUnderline: aBlock
    "If `aBlock` answer true, the cell will be displayed underlined.
     `aBlock` receives one argument (the model element)."

    underlineAction := aBlock

prevent you to have

displayUnderline: true and displayUnderlineBlock: [:item | item isxxx ]

Now you force people to guess that this is a block and to always pass a block when true is just enough.

Ducasse commented 8 months ago

So what is the argument of displayIcon: ... this is not an icon! too bad.