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

Using slot for Immutable check #428

Open
Ducasse opened this issue Jan 27, 2024 · 3 comments
Open

Using slot for Immutable check #428

Ducasse opened this issue Jan 27, 2024 · 3 comments

Comments

@Ducasse
Copy link
Contributor

Ducasse commented Jan 27, 2024

I wonder if we could not use slots to handle such cases

opacity: aNumber

	self
		assert: [ aNumber between: 0.0 and: 1.0 ]
		description: [ 'Opacity value must be within interval [0..1]' ].

	opacity isNotNil
		ifTrue: [ (BlImmutableObjectChangeError object: self) signal ].

	self opacity = aNumber
		ifTrue: [ ^ self ].

	opacity := aNumber
@tinchodias
Copy link
Collaborator

I'd be better, I agree. We are converting the asserts of the style of aNumber between: 0.0 and: 1.0 to method comments.

@Ducasse
Copy link
Contributor Author

Ducasse commented Feb 3, 2024

The assert for range are useless. in Morphic I do not recall problem with such design in alpha or others.

@Ducasse
Copy link
Contributor Author

Ducasse commented Feb 3, 2024

Now the immutability is something else to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants