newspeaklanguage / newspeak

Newspeak is a live object-capability language in the Smalltalk tradition
https://newspeaklanguage.org/
Other
132 stars 11 forks source link

Add style cache; move styling to decorate method #46

Closed Outcue closed 3 years ago

Outcue commented 3 years ago

The Style class contains values used to modify the visual presentation of various widgets. A style cache is populated with pre-constructed style dictionaries to reduce the number of calls to Javascript set/get when creating widgets.

Styling is applied in decorate. The setting of visual state had leaked out of decorate and moved into createVisual. I think it was the indentation of the library architect to defer styling until decorate is called, and this is now the case.

Performance is slightly better, but this isn't a huge performance win. The separation of creation and styling is a good thing though.

I have tracked down as many bugs as I could find, although there may be lurkers.

gbracha commented 3 years ago

I'm inclined to agree that Vassili probably did have a more principled view on decorators, though I doubt if it was ever upheld. So overall, this is probably a good thing. It does mean that the framework kind of has an opinion about decorate: that should be documented.

I also commented on what I suspect are subtle bugs due to mishandling of closures during update.

PS: The UI is a bit buggy even in master right now; I'm trying to see what has gone awry. We have issues with the back/forward buttons in single page (i.e., regular web browser), as well as the odd misbehavior on update (class presenters "losing" their methods), menu and icon problems, and number of things that are not properly reactive (like search results and help). I hope to figure this all out by 2021.

Outcue commented 3 years ago

We can put this on the back burner. I hope the other refresh issues aren't Gene related. If so, I can track them down. Or I can track them down anyway!

gbracha commented 3 years ago

I don't think they are Gene-related, nor do I think they are your fault (I think Gene-related, has something to do with DNA :-)). I do think that something is still wrong with the reactive update, which causes all sorts of problems. The obsolete menu stuff for example - I haven't figured it out yet, but I can see that it is be tied to issues of reactive update in an insidious way. The bugs may have been there all along, but rapid changes expose them.

I do wonder about dismissed menus showing up at the top left corner of the window. Maybe you could look at that - you could use dev tools to see who these DOM nodes belong to.

I'm going to focus on figuring all this out.

gbracha commented 3 years ago

Well, found the out of date menu problem. Not Gene-related. A bug in the menu fragment that has been there all along, proudly crafted by yours truly.

Outcue commented 3 years ago

Glad you found it! I'll take the blame anyway. I have trained under the most accomplished blame givers.

Outcue commented 3 years ago

I'll mothball this for a rainy day.