Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BlElement copying semantics #33

Closed
StephanEggermont opened this issue Sep 26, 2017 · 13 comments
Closed

BlElement copying semantics #33

StephanEggermont opened this issue Sep 26, 2017 · 13 comments

Comments

@StephanEggermont
Copy link
Collaborator

StephanEggermont commented Sep 26, 2017

I would expect #copy to be overridden to not copy the parent.

parent := BlElement new.
one := BlElement new
	background: Color random;
	size: 40@40;
	yourself.
parent addChild:one.
two := one copy.
parent addChild: two
@syrel
Copy link
Contributor

syrel commented Oct 4, 2017

Since one of the first versions of Bloc it is forbidden to copy visual elements.
Unfortunately, #copy and #deepCopy methods got lost at some point.
I restored them with a method comment in #copy that describes that decision :)

Thanks for the reminding! 👍

@dionisiydk
Copy link

dionisiydk commented Oct 4, 2017 via email

@syrel
Copy link
Contributor

syrel commented Oct 4, 2017

It will not :)
We don't see a point in #duplicate for a real world apps. How often do users duplicate UI elements?
Supporting copying in all widgets and visualisations is somehow too much for a fancy demo-only feature.

I am looking forward to learn arguments why #duplicate is so important 😉

@syrel
Copy link
Contributor

syrel commented Oct 4, 2017

Talking about halos. We are not sure if they will exist in their current form.

@StephanEggermont
Copy link
Collaborator Author

As a developer, I see use in #duplicate. It provides an excellent direct way of building applications. For end users it definitely makes sense to be able to clone visual representations of actions. I understand that it is difficult to get the context-dependent semantics right

@syrel
Copy link
Contributor

syrel commented Oct 4, 2017

Aha, interesting input, @StephanEggermont 👍 Thanks!

Here is what I wrote as method comment in #copy:

"Visual elements can not be copied.
	The reason for that is unpredictable amount of conflicting copying behaviours.
	For example, what should happen if a copied element is added to the parent?
	Should we create a new element without the parent or add a copied one to the parent of
	the original element? What should we do with View Models? How to deal with event handlers? ...
	
	Thus, we decided that the most consistent behaviour is to forbid all kind of copying
	and let users instantiate elements by themselves in the way they want it"

The problem with copy is that it is difficult to maintain it... Let's come back to it later when there is nothing else to do 😉

@dionisiydk
Copy link

dionisiydk commented Oct 4, 2017 via email

@dionisiydk
Copy link

dionisiydk commented Oct 4, 2017 via email

@syrel
Copy link
Contributor

syrel commented Oct 4, 2017

@dionisiydk I see. So the use case is prototyping. Very interesting 🤔
We will need to think if #copy fits there. I like the final goal!

Does it mean that if I will call #copy on element I will got error?

Yes, self shouldNotImplement

@dionisiydk
Copy link

dionisiydk commented Oct 4, 2017 via email

@dionisiydk
Copy link

dionisiydk commented Oct 4, 2017 via email

@girba
Copy link
Contributor

girba commented Oct 6, 2017

Nice conversation!

@girba
Copy link
Contributor

girba commented Oct 16, 2018

Currently, we see the issue of copying elements as being tightly related to the one of serializing elements. Thus, we will come back to this after we figure out the larger problem. In the meantime, we close the issue.

@girba girba closed this as completed Oct 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants