You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 29, 2018. It is now read-only.
Well lately I've been reading a book about smalltalk, and I find its object oriented boolean class very impressive, and it's the truly object oriented way to handle conditionals. A sample of smalltalk's conditionals is show below:
aBoolean
ifTrue: [someCode]
ifFalse: [otherCode]
In swift, the syntax can be something like this:
aBooolean.ifTrue{
}.ifFalse{
}
I tried to implement this in a C# library I am working on, but the language of C# has limitations on closure that you have to pass closure with syntax ifTrue(() => {}), rather than just ifTrue{}, which is a bit inconvenient. In Smalltalk, I know that it's possible to remove the parenthesis and arrow sign if closure is the last parameter in a function/method, which is very neat.
So what do you think? Will you consider implementing the extension methods ifTrue{} and ifFalse{} for boolean?
The text was updated successfully, but these errors were encountered:
Well lately I've been reading a book about smalltalk, and I find its object oriented boolean class very impressive, and it's the truly object oriented way to handle conditionals. A sample of smalltalk's conditionals is show below:
In swift, the syntax can be something like this:
I tried to implement this in a C# library I am working on, but the language of C# has limitations on closure that you have to pass closure with syntax ifTrue(() => {}), rather than just ifTrue{}, which is a bit inconvenient. In Smalltalk, I know that it's possible to remove the parenthesis and arrow sign if closure is the last parameter in a function/method, which is very neat.
So what do you think? Will you consider implementing the extension methods ifTrue{} and ifFalse{} for boolean?
The text was updated successfully, but these errors were encountered: