Unexpected - Matrix>>at:at:ifInvalid:

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
cbc
Reply | Threaded
Open this post in threaded view
|

Unexpected - Matrix>>at:at:ifInvalid:

cbc
I expected the argument to the last par to the method to expect a block, but it expects an value (returned directly to the caller).  I would have expected it to behave like at:ifAbsent: instead (which expects the block and evaluates it and returns it if not found).

Guess i'll add a different set of behaviors instead: #row:col:ifAbsent: which expects a block, say.

Any other ideas?

As another question, should the comment for Matrix be updated to not be a complete comparison between Matrix and Array2D, which is no longer in the image?

Thanks,
cbc


Reply | Threaded
Open this post in threaded view
|

Re: Unexpected - Matrix>>at:at:ifInvalid:

marcel.taeumel
Hi Chris,

sounds good. :) Add #row:column:ifAbsent: and deprecate #at:at:#ifInvalid:. I prefer "column" over "col".

Best,
Marcel

Am 26.11.2017 23:29:17 schrieb Chris Cunningham <[hidden email]>:

I expected the argument to the last par to the method to expect a block, but it expects an value (returned directly to the caller).  I would have expected it to behave like at:ifAbsent: instead (which expects the block and evaluates it and returns it if not found).

Guess i'll add a different set of behaviors instead: #row:col:ifAbsent: which expects a block, say.

Any other ideas?

As another question, should the comment for Matrix be updated to not be a complete comparison between Matrix and Array2D, which is no longer in the image?

Thanks,
cbc


Reply | Threaded
Open this post in threaded view
|

Re: Unexpected - Matrix>>at:at:ifInvalid:

Tobias Pape

> On 27.11.2017, at 09:08, Marcel Taeumel <[hidden email]> wrote:
>
> Hi Chris,
>
> sounds good. :) Add #row:column:ifAbsent: and deprecate #at:at:#ifInvalid:. I prefer "column" over "col".
>

Can we (also) have #at:at:ifAbsent: ? I think this would be nice…

Best regards
        -Tobias

> Best,
> Marcel
>> Am 26.11.2017 23:29:17 schrieb Chris Cunningham <[hidden email]>:
>>
>> I expected the argument to the last par to the method to expect a block, but it expects an value (returned directly to the caller).  I would have expected it to behave like at:ifAbsent: instead (which expects the block and evaluates it and returns it if not found).
>>
>> Guess i'll add a different set of behaviors instead: #row:col:ifAbsent: which expects a block, say.
>>
>> Any other ideas?
>>
>> As another question, should the comment for Matrix be updated to not be a complete comparison between Matrix and Array2D, which is no longer in the image?
>>
>> Thanks,
>> cbc
>


cbc
Reply | Threaded
Open this post in threaded view
|

Re: Unexpected - Matrix>>at:at:ifInvalid:

cbc
Ok.  Proposed changes in the inbox.

I kept the #..ifInvalid: calls, as they turned out to be useful (so far).  But I definitely need the #...ifAbsent: varieties, besides them being the more consistently named.

And, yes, added #at:at:ifAbsent: as well.  Although that feels to vague to me.

-cbc

On Mon, Nov 27, 2017 at 1:35 AM, Tobias Pape <[hidden email]> wrote:

> On 27.11.2017, at 09:08, Marcel Taeumel <[hidden email]> wrote:
>
> Hi Chris,
>
> sounds good. :) Add #row:column:ifAbsent: and deprecate #at:at:#ifInvalid:. I prefer "column" over "col".
>

Can we (also) have #at:at:ifAbsent: ? I think this would be nice…

Best regards
        -Tobias

> Best,
> Marcel
>> Am 26.11.2017 23:29:17 schrieb Chris Cunningham <[hidden email]>:
>>
>> I expected the argument to the last par to the method to expect a block, but it expects an value (returned directly to the caller).  I would have expected it to behave like at:ifAbsent: instead (which expects the block and evaluates it and returns it if not found).
>>
>> Guess i'll add a different set of behaviors instead: #row:col:ifAbsent: which expects a block, say.
>>
>> Any other ideas?
>>
>> As another question, should the comment for Matrix be updated to not be a complete comparison between Matrix and Array2D, which is no longer in the image?
>>
>> Thanks,
>> cbc
>