Administrator
|
ifNotNil: takes block with one argument. Why not ifNil:ifNotNil:? Would it be harmful to make ifNil:ifNotNil: and ifNotNil:ifNil: take blocks with one argument?
Thanks, Aik-Siong Koh |
I always use ifNotNilDo: (or ifNil:ifNotNilDo: or variant) if I need to
use a block with one argument. ifNotNil: sends valueWithPossibleArgs: so you don't have to send a block with an argument. askoh wrote: > ifNotNil: takes block with one argument. Why not ifNil:ifNotNil:? Would it be > harmful to make ifNil:ifNotNil: and ifNotNil:ifNil: take blocks with one > argument? > > Thanks, > Aik-Siong Koh -- John Thornborrow http://www.pinesoft.co.uk ****************************************************************************************************************************************** This email is from Pinesoft Limited. Its contents are confidential to the intended recipient(s) at the email address(es) to which it has been addressed. It may not be disclosed to or used by anyone other than the addressee(s), nor may it be copied in anyway. If received in error, please contact the sender, then delete it from your system. Although this email and attachments are believed to be free of virus, or any other defect which might affect any computer or IT system into which they are received and opened, it is the responsibility of the recipient to ensure that they are virus free and no responsibility is accepted by Pinesoft for any loss or damage arising in any way from receipt or use thereof. ******************************************************************************************************************************************* Pinesoft Limited are registered in England, Registered number: 2914825. Registered office: 266-268 High Street, Waltham Cross, Herts, EN8 7EA |
and just to add, when I try and use a one-arg block and try to 'do' it,
I am told: " <- argument of ifNotNil: must be a 0-argument block ->" John Thornborrow wrote: > I always use ifNotNilDo: (or ifNil:ifNotNilDo: or variant) if I need to > use a block with one argument. ifNotNil: sends valueWithPossibleArgs: so > you don't have to send a block with an argument. > > askoh wrote: >> ifNotNil: takes block with one argument. Why not ifNil:ifNotNil:? >> Would it be >> harmful to make ifNil:ifNotNil: and ifNotNil:ifNil: take blocks with one >> argument? >> >> Thanks, >> Aik-Siong Koh > -- John Thornborrow http://www.pinesoft.co.uk ****************************************************************************************************************************************** This email is from Pinesoft Limited. Its contents are confidential to the intended recipient(s) at the email address(es) to which it has been addressed. It may not be disclosed to or used by anyone other than the addressee(s), nor may it be copied in anyway. If received in error, please contact the sender, then delete it from your system. Although this email and attachments are believed to be free of virus, or any other defect which might affect any computer or IT system into which they are received and opened, it is the responsibility of the recipient to ensure that they are virus free and no responsibility is accepted by Pinesoft for any loss or damage arising in any way from receipt or use thereof. ******************************************************************************************************************************************* Pinesoft Limited are registered in England, Registered number: 2914825. Registered office: 266-268 High Street, Waltham Cross, Herts, EN8 7EA |
On Tue, Apr 29, 2008 at 11:43:44AM +0100, John Thornborrow wrote:
> >I always use ifNotNilDo: (or ifNil:ifNotNilDo: or variant) if I need to > >use a block with one argument. ifNotNil: sends valueWithPossibleArgs: so > >you don't have to send a block with an argument. > > > and just to add, when I try and use a one-arg block and try to 'do' it, > I am told: " <- argument of ifNotNil: must be a 0-argument block ->" This bug is documented on Mantis at http://bugs.squeak.org/view.php?id=4867 Dave |
Free forum by Nabble | Edit this page |